What do you think this is doing?
Session::pull('success', 'Welcome Aboard. Please Login!');
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
Hello,
I have been trying to pass session and unsuccessfuly:
LoginController.php
...
Session::put('success', 'Welcome Aboard. Please Login!');
return redirect('login');
}
StoreController.php
public function login()
{
Session::pull('success', 'Welcome Aboard. Please Login!');
return view('store.login');
}
login.blade.php
@if ($message = Session::get('success'))
<div class="alert alert-success alert-block">
<button type="button" class="close" data-dismiss="alert">×</button>
<strong>{{ $message }}</strong>
</div>
@endif
In the login.blade.php the success message is not popping out!
It removes the success key from the Session; then you later check for the key, it's gone.
public function login()
{
return view('store.login');
}
@if ($message = Session::pull('success'))
<div class="alert alert-success alert-block">
<button type="button" class="close" data-dismiss="alert">×</button>
<strong>{{ $message }}</strong>
</div>
@endif
If the only time you want to display the message is the next request; then flash it to the Session.
Please or to participate in this conversation.