Laravel 8 模型监听
只要触发了模型的 create
、updated
、restored
或 deleted
事件,模型观察器就会记录模型更改。您可以通过监听器的 events
选项指定应记录哪些模型事件:
'watchers' => [
Watchers\ModelWatcher::class => [
'enabled' => env('TELESCOPE_MODEL_WATCHER', true),
'events' => ['eloquent.created*', 'eloquent.updated*'],
],
...
],