mardi 7 février 2017

laravel events, are they executing synchronously?

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?



from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/2kDbB85
via IFTTT

Aucun commentaire:

Enregistrer un commentaire