HasEvents
trait HasEvents (View source)
Properties
protected array | $dispatchesEvents | The event map for the model. |
|
protected array | $observables | User exposed observable events. |
Methods
Boot the has event trait for a model.
Resolve the observe class names from the attributes.
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 the event listeners for the model.
Get the event map for the model.
Get the event dispatcher instance.
Unset the event dispatcher for models.
Execute a callback without firing any model events for any model type.
Details
static protected void
registerModelEvent(string $event, QueuedClosure|callable|array|class-string $callback)
Register a model event with the dispatcher.
protected mixed
fireModelEvent(string $event, bool $halt = true)
Fire the given event for the model.
protected mixed|null
fireCustomModelEvent(string $event, string $method)
Fire a custom model event for the given event.
static void
retrieved(QueuedClosure|callable|array|class-string $callback)
Register a retrieved model event with the dispatcher.
static void
saving(QueuedClosure|callable|array|class-string $callback)
Register a saving model event with the dispatcher.
static void
saved(QueuedClosure|callable|array|class-string $callback)
Register a saved model event with the dispatcher.
static void
updating(QueuedClosure|callable|array|class-string $callback)
Register an updating model event with the dispatcher.
static void
updated(QueuedClosure|callable|array|class-string $callback)
Register an updated model event with the dispatcher.
static void
creating(QueuedClosure|callable|array|class-string $callback)
Register a creating model event with the dispatcher.
static void
created(QueuedClosure|callable|array|class-string $callback)
Register a created model event with the dispatcher.
static void
replicating(QueuedClosure|callable|array|class-string $callback)
Register a replicating model event with the dispatcher.
static void
deleting(QueuedClosure|callable|array|class-string $callback)
Register a deleting model event with the dispatcher.
static void
deleted(QueuedClosure|callable|array|class-string $callback)
Register a deleted model event with the dispatcher.