Skip to content

Commit

Permalink
Merge pull request #1 from AtomClock/feature-allow-managing-messages-…
Browse files Browse the repository at this point in the history
…through-public-methods

added public methods to access messages
  • Loading branch information
MaximeDupaul authored Sep 22, 2016
2 parents 4531faa + dfcbbc8 commit 65a4a13
Showing 1 changed file with 17 additions and 2 deletions.
19 changes: 17 additions & 2 deletions src/Mdupaul/Flash/FlashNotifier.php
Original file line number Diff line number Diff line change
Expand Up @@ -114,8 +114,8 @@ public function message($message, $level = 'info')
{

$messages = [];
if (Session::has('flash_notification.messages')) {
$messages = Session::get('flash_notification.messages');
if ($this->hasNotificationMessages()) {
$messages = $this->getNotificationMessages();
}
$messages[] = [$level => $message];

Expand All @@ -136,4 +136,19 @@ public function important()
return $this;
}

/**
* Tells if there are notification messages
* @return mixed
*/
public function hasNotificationMessages() {
return Session::has('flash_notification.messages');
}

/**
* Returns the notification messages
* @return mixed
*/
public function getNotificationMessages() {
return Session::get('flash_notification.messages');
}
}

0 comments on commit 65a4a13

Please sign in to comment.