Nov 23, 2016
0
Level 4
Laravel 5.3 - How to keep the session message until the users logs out
I am sending a welcome message to user after registration. I have modified the trait method in my controller like so:
public function register(Request $request)
{
$this->validator($request->all())->validate();
event(new Registered($user = $this->create($request->all())));
$this->guard()->login($user);
Session::set('message','messages.welcome');
return redirect($this->redirectPath())->with('message', 'messages.welcome');
}
And then I am showing the message in the view like this:
@if (session('message'))
@include(session('message'))
@endif
But when I refresh the view the messages disappears, how can I keep the messages until the user logs out?
Please or to participate in this conversation.