You send the variable $status back to the view this way. How do you access the current $status variable?
Jun 18, 2017
3
Level 33
Create session in listener for Authenticated
Hi,
I've made a listener for the use Illuminate\Auth\Events\Authenticated event that's being fired when a user signs in.
The listener checks if the application is active it looks like this:
class CheckApplicationStatus
{
/**
* Check if application is active
*
* @param Authenticated $event
* @return void
*/
public function handle(Authenticated $event)
{
if(! appIsActive(settings()->active, $event->user)) {
Auth::logout();
return redirect('/')
->with(['status' => 'Applicatie is niet actief, contacteer de beheerder']);
}
session()->flash('status', sprintf('Welkom %s', $event->user->name));
}
}
The problem is that when the app is NOT active it signs the user out but the session message does not show up?!
When a user signs in succesful the welcome status does show up.
The html for the session is in my app.blade so every view has it.
What could I be doing wrong here?
Level 88
Please or to participate in this conversation.