Reputation: 66
I've made a form that uses Route::delete();
to delete a user (which works), however I am struggling to pass a success messages that says 'User deleted successfully'.
After $user->delete();
I call return redirect('dashboard/users/list')->with('success', 'User deleted successfully.');
, but this returns an error similar to '$success is not set' when calling it in blade.
Is there a way to pass messages through a redirect instead of just calling the view?
Upvotes: 2
Views: 1131
Reputation: 1632
The only way to pass data thru redirect is only using parameter,
return redirect('dashboard/users/list')->with('success', 'User deleted successfully.');
and in show() read it with
{{ Session::get('success') }}
Upvotes: 3