I did in controller
Session::flash('message', 'Successfully updated!');
and in view
@if (Session::has('message'))
<li>{!! Session::get('message') !!}</li>
@endif
However, nothing is passed on view, when i do var_dump(Session::get('message')); I can view message, pls help me
It should be: with "\" in your controller
\Session::flash('message', 'Successfully updated!');
And in your view use session() as in Laravel docs.
@if (Session::has('message'))
<li>{!! session('message') !!}</li>
@endif
Please see to official Laravel docs Or This very simple step by step tutorial Flash Messages in Laravel 5
Assuming that in controller... in the method index() before returning the view you might have put that code Session::flash('message', 'Successfully updated!');
But the Session class here might be taken from the namespaces used in your controller. So add a "\"
before session to make it work..
Like :
\Session::flash('message', 'Successfully updated!');
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With