Friday, April 14, 2017

Capture the individual Eloquent Model event in Laravel 5.4

By Default, Laravel eloquent model fires following events : 'creating', 'created', 'updating', 'updated', 'deleting', 'deleted', 'saving', 'saved', 'restoring', 'restored'

I am using listing for eloquent events using wildcard listener in my AppServiceProvider Like this :

    /**
     * Bootstrap any application services.
     *
     * @return void
     */
    public function boot()
    {
        \Event::listen(['eloquent.*'], function ($a){
            var_dump($a);
        });
    }

I am getting nothing when I dump $a.

I know we can capture event with observable. Is there other ways to do this?



via Pankit Gami

Advertisement