HasEvents
trait HasEvents
Properties
protected array | $events | The event map for the model. |
|
protected array | $observables | User exposed observable events. |
Methods
Register an 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.
Remove all of the event listeners for the model.
Get the event dispatcher instance.
Unset the event dispatcher for models.
Details
at line 33
static void
observe(object|string $class)
Register an observer with the Model.
at line 54
array
getObservableEvents()
Get the observable event names.
at line 72
$this
setObservableEvents(array $observables)
Set the observable event names.
at line 85
void
addObservableEvents(array|mixed $observables)
Add an observable event name.
at line 98
void
removeObservableEvents(array|mixed $observables)
Remove an observable event name.
at line 112
static protected void
registerModelEvent(string $event, Closure|string $callback)
Register a model event with the dispatcher.
at line 128
protected mixed
fireModelEvent(string $event, bool $halt = true)
Fire the given event for the model.
at line 159
protected mixed|null
fireCustomModelEvent(string $event, string $method)
Fire a custom model event for the given event.
at line 178
protected mixed
filterModelEventResults(mixed $result)
Filter the model event results.
at line 195
static void
saving(Closure|string $callback)
Register a saving model event with the dispatcher.
at line 206
static void
saved(Closure|string $callback)
Register a saved model event with the dispatcher.
at line 217
static void
updating(Closure|string $callback)
Register an updating model event with the dispatcher.
at line 228
static void
updated(Closure|string $callback)
Register an updated model event with the dispatcher.
at line 239
static void
creating(Closure|string $callback)
Register a creating model event with the dispatcher.
at line 250
static void
created(Closure|string $callback)
Register a created model event with the dispatcher.
at line 261
static void
deleting(Closure|string $callback)
Register a deleting model event with the dispatcher.
at line 272
static void
deleted(Closure|string $callback)
Register a deleted model event with the dispatcher.
at line 282
static void
flushEventListeners()
Remove all of the event listeners for the model.
at line 300
static Dispatcher
getEventDispatcher()
Get the event dispatcher instance.
at line 311
static void
setEventDispatcher(Dispatcher $dispatcher)
Set the event dispatcher instance.
at line 321
static void
unsetEventDispatcher()
Unset the event dispatcher for models.