/** * Remove all of the event listeners for the class. * * @return void */ public static function flushEventListeners() { if (!isset(static::$dispatcher)) { return; } foreach (static::getObservableEvents() as $event) { static::$dispatcher->forget("{$event}: " . get_called_class()); } }
/** * Remove a set of listeners from the dispatcher. * * @param string $event * @return void * @static */ public static function forget($event) { \Illuminate\Events\Dispatcher::forget($event); }
/** * Remove all of the event listeners for the model. * * @return void */ 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()); } }