Happy christmas guys!
I am new to Laravel. I had an initial question when I try to use a service provider and a model event to register update information.
Followed the online doc: https://laravel.com/docs/5.3/eloquent#events
After all the code is compiled, I find that the model event only fires when it is created, but never writes anything when I edit the user.
Did I miss something? Feel that the user $ has not received the intended destination. Where is it from? from another service provider?
Any explanation or hint would be appreciated!
<?php namespace App\Providers; use App\User; use Illuminate\Support\ServiceProvider; class AppServiceProvider extends ServiceProvider { public function boot() { User::creating(function ($user) { Log::info('event creating'); }); User::created(function ($user) { Log::info('event created'); }); User::updating(function ($user) { Log::info('event updating'); }); User::updated(function ($user) { Log::info('event updated'); }); User::saving(function ($user) { Log::info('event saving'); }); User::saved(function ($user) { Log::info('event saved'); }); User::deleting(function ($user) { Log::info('event deleting'); }); User::deleted(function ($user) { Log::info('event deleted'); }); } public function register() {
source share