From 1bdd7823d036345924526f230056594658fe7c61 Mon Sep 17 00:00:00 2001 From: Andi Nitsche Date: Tue, 26 Nov 2019 10:41:07 +0100 Subject: [PATCH] Update FlashNotifier.php --- src/Laracasts/Flash/FlashNotifier.php | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/Laracasts/Flash/FlashNotifier.php b/src/Laracasts/Flash/FlashNotifier.php index d581d5d..71fdd4b 100644 --- a/src/Laracasts/Flash/FlashNotifier.php +++ b/src/Laracasts/Flash/FlashNotifier.php @@ -159,9 +159,16 @@ public function clear() */ protected function flash() { - $this->session->flash('flash_notification', $this->messages); + $notifications = session('flash_notification', collect()); + if( $this->messages->count() > 0 ) { + foreach( $this->messages as $message ) { + $notifications->push($message); + } + } - return $this; + $this->session->flash('flash_notification', $notifications->unique()); + + return $this; } }