witherrors laravel

Solutions on MaxInterview for witherrors laravel by the best coders in the world

showing results for - "witherrors laravel"
Nadir
24 Jan 2019
1Inside controller : 
2return back()->withError('You are not logged in or Your session has expired');
3
4Inside blade file : 
5 @if(Session::has('errors'))
6 	toastr.error("{{Session::get('errors')->first()}}");
7 @endif
8   
9It’s a “magic” method, in that any call to a method with a prefix of with will 
10be added to the session as flash data. So withError() will add flash data
11under the key error; withErrors() will add flash data under the key errors; 
12withSuccess() will add flash data under the key of success; and so on.