trait HasEvents (View source)
protected array | $dispatchesEvents | The event map for the model. | |
protected array | $observables | User exposed observable events. |
static void | observe(object|array|string $classes) Register observers with the model. | |
void | registerObserver(object|string $class) Register a single observer with the model. | |
array | getObservableEvents() Get the observable event names. | |
$this | setObservableEvents(array $observables) Set the observable event names. | |
void | addObservableEvents(array|mixed $observables) Add an observable event name. | |
void | removeObservableEvents(array|mixed $observables) Remove an observable event name. | |
static void | registerModelEvent(string $event, Closure|string $callback) Register a model event with the dispatcher. | |
mixed | fireModelEvent(string $event, bool $halt = true) Fire the given event for the model. | |
mixed|null | fireCustomModelEvent(string $event, string $method) Fire a custom model event for the given event. | |
mixed | filterModelEventResults(mixed $result) Filter the model event results. | |
static void | retrieved(Closure|string $callback) Register a retrieved model event with the dispatcher. | |
static void | saving(Closure|string $callback) Register a saving model event with the dispatcher. | |
static void | saved(Closure|string $callback) Register a saved model event with the dispatcher. | |
static void | updating(Closure|string $callback) Register an updating model event with the dispatcher. | |
static void | updated(Closure|string $callback) Register an updated model event with the dispatcher. | |
static void | creating(Closure|string $callback) Register a creating model event with the dispatcher. | |
static void | created(Closure|string $callback) Register a created model event with the dispatcher. | |
static void | replicating(Closure|string $callback) Register a replicating model event with the dispatcher. | |
static void | deleting(Closure|string $callback) Register a deleting model event with the dispatcher. | |
static void | deleted(Closure|string $callback) Register a deleted model event with the dispatcher. | |
static void | flushEventListeners() Remove all of the event listeners for the model. | |
static Dispatcher | getEventDispatcher() Get the event dispatcher instance. | |
static void | setEventDispatcher(Dispatcher $dispatcher) Set the event dispatcher instance. | |
static void | unsetEventDispatcher() Unset the event dispatcher for models. | |
static mixed | withoutEvents(callable $callback) Execute a callback without firing any model events for any model type. |
Register observers with the model.
Register a single observer with the model.
Get the observable event names.
Set the observable event names.
Add an observable event name.
Remove an observable event name.
Register a model event with the dispatcher.
Fire the given event for the model.
Fire a custom model event for the given event.
Filter the model event results.
Register a retrieved model event with the dispatcher.
Register a saving model event with the dispatcher.
Register a saved model event with the dispatcher.
Register an updating model event with the dispatcher.
Register an updated model event with the dispatcher.
Register a creating model event with the dispatcher.
Register a created model event with the dispatcher.
Register a replicating model event with the dispatcher.
Register a deleting model event with the dispatcher.
Register a deleted model event with the dispatcher.
Remove all of the event listeners for the model.
Get the event dispatcher instance.
Set the event dispatcher instance.
Unset the event dispatcher for models.
Execute a callback without firing any model events for any model type.
© Taylor Otwell
Licensed under the MIT License.
Laravel is a trademark of Taylor Otwell.
https://laravel.com/api/5.8/Illuminate/Database/Eloquent/Concerns/HasEvents.html