I\'m making my first app in Laravel and am trying to get my head around the session flash messages. As far as I\'m aware in my controller action I can set a flash message ei
One solution would be to flash two variables into the session:
for example:
Session::flash('message', 'This is a message!');
Session::flash('alert-class', 'alert-danger');
Then in your view:
@if(Session::has('message'))
{{ Session::get('message') }}
@endif
Note I've put a default value into the Session::get()
. that way you only need to override it if the warning should be something other than the alert-info
class.
(that is a quick example, and untested :) )