mardi 30 janvier 2018

Laravel: Reactivating listeners after flushEventListeners()

I have some functionality that is being enacted by my model's event handler that I need to prevent from firing under a specific circumstance.

protected static function bootLogSubject()
{
    static::created(function ($subject) {
        $subject->logContent('create', Auth::user());
    });

I am aware that I can use flushEventListeners() to stop the event firing. This works fine, but is it possible to switch the listeners back on again (unflush? bind?) once I have finished what I need to do?



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

Aucun commentaire:

Enregistrer un commentaire