# How to disable model events in Laravel

> If you ever need to disable model events for a while, the following snippet can do the trick: This often comes in handy when seeding data.

- URL: https://graffino.com/til/how-to-disable-model-events-in-laravel
- Author: Denisa Halmaghi
- Channel: laravel
- Published: 2022-05-03
- Updated: 2025-03-19

If you ever need to disable model events for a while, the following snippet can do the trick:

```php
$dispatcher = YourModel::getEventDispatcher();

YourModel::unsetEventDispatcher();

// Do your stuff

YourModel::setEventDispatcher($dispatcher);
```

This often comes in handy when seeding data.
