Laravel - Getting Started - Events Using Closures

Instead of using custom event classes, you may register closures that execute when various model events are dispatched. Typically, you should register these closures in the booted method of your model:


If needed, you may utilize queueable anonymous event listeners when registering model events. This will instruct Laravel to execute the model event listener in the background using your application's queue:

    use function Illuminate\Events\queueable;
    static::created(queueable(function ($user) {