Laravel - Getting Started - Muting Events

You may occasionally need to temporarily "mute" all events fired by a model. You may achieve this using the withoutEvents method. The withoutEvents method accepts a closure as its only argument. Any code executed within this closure will not dispatch model events. For example, the following example will fetch and delete an App\Models\User instance without dispatching any model events. Any value returned by the closure will be returned by the withoutEvents method:

    
    use App\Models\User;
    
    $user = User::withoutEvents(function () use () {
        User::findOrFail(1)->delete();
    
        return User::find(2);
    });