@if (Session::has('flash_notification')) // Here is the problem - a empty array flash_notification is checked as true
@if (Session::has('flash_notification.overlay'))
@include('partials/_modal', ['modalClass' => 'flash-modal', 'title' => 'Notice', 'body' => Session::get('flash_notification.message')])
@else
@if(Session::has('flash_notification.level') && Session::has('flash_notification.message')) // My solution, to ensure a message is sent
<div class="alert alert-{{ Session::get('flash_notification.level') }}">
<button type="button" class="close" data-dismiss="alert" aria-hidden="true">ร</button>
<h4>{{ Session::get('flash_notification.message') }}</h4>
</div>
@endif
@endif
@endif
When no flash message is sent to the view, Session::has('flash_notification') still returns true, because it is a empty array. A ugly div (with white bg) with a dismiss x is shown.
I've changed my own code, so it also checks if Session also has flash_notification.level && flash_notification.message, but this is not a perfect way to check for it.
Btw. Jeffrey - I really love your Laracasts! Big thumbs up from Denmark!