Skip to content

Commit

Permalink
Make fluent, and add "important" flag
Browse files Browse the repository at this point in the history
  • Loading branch information
Laracasts committed Feb 1, 2015
1 parent 42d30ed commit 5ee8dd8
Showing 1 changed file with 36 additions and 7 deletions.
43 changes: 36 additions & 7 deletions src/Laracasts/Flash/FlashNotifier.php
Expand Up @@ -28,62 +28,91 @@ function __construct(SessionStore $session)
public function info($message)
{
$this->message($message, 'info');

return $this;
}

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

return $this;
}

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

return $this;
}

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

return $this;
}

/**
* Flash an overlay modal.
*
* @param string $message
* @param string $title
* @param string $message
* @param string $title
* @return $this
*/
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);

return $this;
}

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

return $this;
}

/**
* Add an "important" flash to the session.
*
* @return $this
*/
public function important()
{
$this->session->flash('flash_notification.important', true);

return $this;
}

}

0 comments on commit 5ee8dd8

Please sign in to comment.