A look at the Laravel Api Model::flushEventListeners() should "Delete all event listeners for the model."
EDIT
You can write a user base of methods on this:
public static function flushEventListeners() { if (! isset(static::$dispatcher)) { return; } $instance = new static; foreach ($instance->getObservableEvents() as $event) { static::$dispatcher->forget("eloquent.{$event}: ".get_called_class()); } }
Something like this might be:
public static function flushEventListenersProvided($events) { if (! isset(static::$dispatcher)) { return; } $instance = new static; foreach ($instance->getObservableEvents() as $event) { if(in_array($event, $events)){ static::$dispatcher->forget("eloquent.{$event}: ".get_called_class()); } } }
and maybe add it as a dash to the models or a basic model that will expand with all of your models. This code has not been tested, but should give you an idea of how this can be done.
source share