Skip to content

Commit

Permalink
Clean up a few things
Browse files Browse the repository at this point in the history
  • Loading branch information
Laracasts committed Feb 1, 2015
1 parent f55e9e8 commit 42d30ed
Showing 1 changed file with 27 additions and 13 deletions.
40 changes: 27 additions & 13 deletions src/Laracasts/Flash/FlashNotifier.php
Original file line number Diff line number Diff line change
@@ -1,13 +1,18 @@
<?php namespace Laracasts\Flash;

class FlashNotifier {
class FlashNotifier
{

/**
* The session writer.
*
* @var SessionStore
*/
private $session;

/**
* Create a new flash notifier instance.
*
* @param SessionStore $session
*/
function __construct(SessionStore $session)
Expand All @@ -16,57 +21,66 @@ function __construct(SessionStore $session)
}

/**
* @param $message
* @param $title
* Flash an information message.
*
* @param string $message
*/
public function info($message)
{
$this->message($message, 'info');
}

/**
* @param $message
* @param $title
* Flash a success message.
*
* @param string $message
*/
public function success($message)
{
$this->message($message, 'success');
}

/**
* @param $message
* @param $title
* Flash an error message.
*
* @param string $message
*/
public function error($message)
{
$this->message($message, 'danger');
}

/**
* @param $message
* @param $title
* Flash a warning message.
*
* @param string $message
*/
public function warning($message)
{
$this->message($message, 'warning');
}

/**
* @param $message
* @param $title
* Flash an overlay modal.
*
* @param string $message
* @param string $title
*/
public function overlay($message, $title = 'Notice')
{
$this->message($message, 'info', $title);

$this->session->flash('flash_notification.overlay', true);
$this->session->flash('flash_notification.title', $title);
}

/**
* @param $message
* Flash a general message.
*
* @param string $message
* @param string $level
*/
public function message($message, $level = 'info', $title = 'Notice')
public function message($message, $level = 'info')
{
$this->session->flash('flash_notification.message', $message);
$this->session->flash('flash_notification.level', $level);
Expand Down

0 comments on commit 42d30ed

Please sign in to comment.