October\Rain\Database\Concerns\HasEvents
Overview
HasEvents concern for a model
Protected Properties
protected static array $eventsBooted
eventsBooted is an array of models booted events
Public Methods
public static fetched()
public static fetched(Closure|string $callback): void
fetched creates a new native event for handling afterFetch().
public static fetching()
public static fetching(Closure|string $callback): void
fetching creates a new native event for handling beforeFetch().
public static flushEventListeners()
public static flushEventListeners(): void
flushEventListeners removes all of the event listeners for the model Also flush registry of models that had events booted Allows painless unit testing.
public getObservableEvents()
public getObservableEvents(): array
getObservableEvents as their names.
Protected Methods
protected afterBoot()
protected afterBoot(): void
afterBoot is called after the model is constructed for the first time.
protected afterCreate()
protected afterCreate(): void
afterCreate handles the "created" model event
protected afterDelete()
protected afterDelete(): void
afterDelete handles the "deleted" model event
protected afterFetch()
protected afterFetch(): void
afterFetch handles the "fetched" model event
protected afterInit()
protected afterInit(): void
afterInit is called after the model is constructed, a nicer version of overriding the __construct method.
protected afterRelation()
protected afterRelation($name, $model): void
beforeRelation is fired on the relation model instance after it is created
protected afterSave()
protected afterSave(): void
afterSave handles the "saved" model event
protected afterUpdate()
protected afterUpdate(): void
afterUpdate handles the "updated" model event
protected beforeCreate()
protected beforeCreate(): void
beforeCreate handles the "creating" model event
protected beforeDelete()
protected beforeDelete(): void
beforeDelete handles the "deleting" model event
protected beforeFetch()
protected beforeFetch(): void
beforeFetch handles the "fetching" model event
protected beforeRelation()
protected beforeRelation($name, $relation): void
beforeRelation is fired on the relation object before it is created
protected beforeReplicate()
protected beforeReplicate(): void
protected beforeSave()
protected beforeSave(): void
beforeSave handles the "saving" model event
protected beforeUpdate()
protected beforeUpdate(): void
beforeUpdate handles the "updating" model event
protected bootNicerEvents()
protected bootNicerEvents(): void
bootNicerEvents to this model, in the format of method overrides.
protected initializeModelEvent()
protected initializeModelEvent(): void
initializeModelEvent is called every time the model is constructed.