Reputation: 2069
In my auth middleware I have the following code:
if (! Auth::user()->enabled) {
Auth::logout();
// $request->session()->flash('Test', 'Test');
// return redirect()->route('site::home');
return redirect()->route('site::home')->withFlash('Test');
}
I'm trying to redirect the user back to the login page with a flash message but whenever I look into the session() there's no flash message.
What am I doing wrong? it feels like i've tried every variation of a flash message and none of it seems to work
Upvotes: 0
Views: 2871
Reputation: 49
Try this instead
return redirect()->route('route_name')->with('custom_key', 'Custom Message');
Upvotes: 1
Reputation: 1138
return redirect()->route('site::home')->flash('This is a message!');
OR
return \Redirect::back()->withWarning( 'Message you want show in View' );
Upvotes: 1