HasEvents
Properties
$dispatchesEvents array
The event map for the model.
Allows for object-based events for native Eloquent events.
$observables array
User exposed observable events.
These are extra user-defined events observers may subscribe to.
Methods
observe ( $classes ) : void
Register observers with the model.
Parameters
- $classes object|array|string
registerObserver ( $class ) : void
Register a single observer with the model.
Parameters
- $class object|string
resolveObserverClassName ( $class ) : string
Resolve the observer's class name from an object or string.
Parameters
- $class object|string
getObservableEvents ( ) : array
Get the observable event names.
setObservableEvents ( array $observables ) : $this
Set the observable event names.
Parameters
- $observables array
addObservableEvents ( $observables ) : void
Add an observable event name.
Parameters
- $observables array|mixed
removeObservableEvents ( $observables ) : void
Remove an observable event name.
Parameters
- $observables array|mixed
registerModelEvent ( $event , $callback ) : void
Register a model event with the dispatcher.
Parameters
- $event string
- $callback QueuedClosure |Closure |string|array
fireModelEvent ( $event , $halt ) : mixed
Fire the given event for the model.
Parameters
- $event string
- $halt bool
fireCustomModelEvent ( $event , $method ) : mixed|null
Fire a custom model event for the given event.
Parameters
- $event string
- $method string
filterModelEventResults ( $result ) : mixed
Filter the model event results.
Parameters
- $result mixed
retrieved ( $callback ) : void
Register a retrieved model event with the dispatcher.
Parameters
- $callback QueuedClosure |Closure |string|array
saving ( $callback ) : void
Register a saving model event with the dispatcher.
Parameters
- $callback QueuedClosure |Closure |string|array
saved ( $callback ) : void
Register a saved model event with the dispatcher.
Parameters
- $callback QueuedClosure |Closure |string|array
updating ( $callback ) : void
Register an updating model event with the dispatcher.
Parameters
- $callback QueuedClosure |Closure |string|array
updated ( $callback ) : void
Register an updated model event with the dispatcher.
Parameters
- $callback QueuedClosure |Closure |string|array
creating ( $callback ) : void
Register a creating model event with the dispatcher.
Parameters
- $callback QueuedClosure |Closure |string|array
created ( $callback ) : void
Register a created model event with the dispatcher.
Parameters
- $callback QueuedClosure |Closure |string|array
replicating ( $callback ) : void
Register a replicating model event with the dispatcher.
Parameters
- $callback QueuedClosure |Closure |string|array
deleting ( $callback ) : void
Register a deleting model event with the dispatcher.
Parameters
- $callback QueuedClosure |Closure |string|array
deleted ( $callback ) : void
Register a deleted model event with the dispatcher.
Parameters
- $callback QueuedClosure |Closure |string|array
flushEventListeners ( ) : void
Remove all the event listeners for the model.
setEventDispatcher ( Dispatcher $dispatcher ) : void
Set the event dispatcher instance.
Parameters
- $dispatcher Dispatcher
unsetEventDispatcher ( ) : void
Unset the event dispatcher for models.
withoutEvents ( callable $callback ) : mixed
Execute a callback without firing any model events for any model type.
Parameters
- $callback callable