Reputation: 21
How can i redirect with success or error message without using sessions in laravel
Currently I am using the following code for redirect :
return redirect('dashboard')->with('status', 'Profile updated!');
But this code Need session to display the success message.
Upvotes: 1
Views: 523
Reputation: 2995
You can set another variable status type along with the status like below,
return redirect('dashboard')->with(['status'=>'Profile updated!','status_type'=>'success']);
And in your dashboard blade file use
@if(isset($status))
<p class="alert alert-{{ $status_type }}" >{{ $status }}</p>
@endif
Upvotes: 1