basically what I want to do is use a special token auto login
but: only for a subset of pages. Say, commenting is ok with the token login. Changing credit card information and purchasing items is not ok with the token login.
So I want to store a boolean token_login on the users table. 
On each login i set the token_login to false using the event handler
class EventServiceProvider extends ServiceProvider
{
    protected $listen = [
      'Illuminate\Auth\Events\Login' => [PostLoginListener::class],
    ];
When a true token login is performed, I set it to true.
So I expect the event to get called -> token_login = false
then code keeps running, setting token_login = true in case of the actual autologin.
Now this requires that the event actually always fires synchronously and always before the other code. Is that the case?
As long as your PostLoginListener does not implement the Illuminate\Contracts\Queue\ShouldQueue interface, your event will be processed synchronously.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With