Events

Introduction

Streams dispatches a number of helpful Laravel type events.

Any data passed to the event that is documented can be accessed via an accessor method:

// The dispatched event.
app('events')->dispatch(new \Anomaly\Streams\Platform\Addon\Event\AddonsHaveRegistered($addons));

// Within your listener.
$addons = $event->getAddons();

Request Lifecycle

Booting

This event is fired as soon as StreamsServiceProvider::boot() starts.

app('events')->dispatch(new \Anomaly\Streams\Platform\Event\Booting());

Booted

This event is fired as soon as StreamsServiceProvider::booted() starts. This is after the Streams Platform boots but before registering addons.

app('events')->dispatch(new \Anomaly\Streams\Platform\Event\Booted());

AddonsHaveRegistered

This event is fired after all the addon service providers have been registered but before the Streams Platform boot process has proceeded. The event contains the addon collection.

app('events')->dispatch(new \Anomaly\Streams\Platform\Addon\Event\AddonsHaveRegistered($addons));

Ready

This event is fired after the Streams Platform has booted and all addons have been registered and booted and the system is ready to respond.

app('events')->dispatch(new \Anomaly\Streams\Platform\Event\Ready());

Addon Management

ModuleWasInstalled

This event is fired after a module is installed. The event contains the installed module.

app('events')->dispatch(new \Anomaly\Streams\Platform\Addon\Module\Event\ModuleWasInstalled($module));

ModuleWasUninstalled

This event is fired after a module is uninstalled. The event contains the uninstalled module.

app('events')->dispatch(new \Anomaly\Streams\Platform\Addon\Module\Event\ModuleWasUninstalled($module));

ModuleWasEnabled

This event is fired after a module is enabled. The event contains the enabled module.

app('events')->dispatch(new \Anomaly\Streams\Platform\Addon\Module\Event\ModuleWasEnabled($module));

ModuleWasDisabled

This event is fired after a module is disabled. The event contains the disabled module.

app('events')->dispatch(new \Anomaly\Streams\Platform\Addon\Module\Event\ModuleWasDisabled($module));

ExtensionWasInstalled

This event is fired after a extension is installed. The event contains the installed extension.

app('events')->dispatch(new \Anomaly\Streams\Platform\Addon\Extension\Event\ExtensionWasInstalled($extension));

ExtensionWasUninstalled

This event is fired after a extension is uninstalled. The event contains the uninstalled extension.

app('events')->dispatch(new \Anomaly\Streams\Platform\Addon\Extension\Event\ExtensionWasUninstalled($extension));

ExtensionWasEnabled

This event is fired after a extension is enabled. The event contains the enabled extension.

app('events')->dispatch(new \Anomaly\Streams\Platform\Addon\Extension\Event\ExtensionWasEnabled($extension));

ExtensionWasDisabled

This event is fired after a extension is disabled. The event contains the disabled extension.

app('events')->dispatch(new \Anomaly\Streams\Platform\Addon\Extension\Event\ExtensionWasDisabled($extension));

Control Panel

GatherNavigation

This event is fired after the default control panel navigation is set and any additional navigation items are allowed to be added to the builder. The event contains the control panel builder instance.

app('events')->dispatch(new \Anomaly\Streams\Platform\Ui\ControlPanel\Component\Navigation\Event\GatherNavigation($builder));

GatherSections

This event is fired after the default control panel sections are set and any additional sections items are allowed to be added to the builder. The event contains the control panel builder instance.

app('events')->dispatch(new \Anomaly\Streams\Platform\Ui\ControlPanel\Component\Section\Event\GatherSections($builder));

GatherShortcuts

This event is fired after the default control panel shortcuts are set and any additional shortcuts items are allowed to be added to the builder. The event contains the control panel builder instance.

app('events')->dispatch(new \Anomaly\Streams\Platform\Ui\ControlPanel\Component\Shortcut\Event\GatherShortcuts($builder));

ControlPanelWasBuilt

This event is fired after the control panel is built and ready to handle the request. The event contains the control panel builder instance.

app('events')->dispatch(new \Anomaly\Streams\Platform\Ui\ControlPanel\Event\ControlPanelWasBuilt($builder));

Form Builders

FormWasBuilt

This event is fired after the form builder is built and ready to respond. The event contains the form builder instance.

app('events')->dispatch(new \Anomaly\Streams\Platform\Ui\Form\Event\FormWasBuilt($builder));

FormWasPosted

This event is fired after the form builder has been built and is about to handle a POST request. The event contains the form builder instance.

app('events')->dispatch(new \Anomaly\Streams\Platform\Ui\Form\Event\FormWasPosted($builder));

FormWasSaved

This event is fired after the form builder has been built, posted, and has saved the model but before the response has been generated. The event contains the form builder instance.

app('events')->dispatch(new \Anomaly\Streams\Platform\Ui\Form\Event\FormWasSaved($builder));

Table Builders

TableIsQuerying

This event is fired at the beginning of the query process for table builders. The event contains the table builder instance and the query builder object.

app('events')->dispatch(new \Anomaly\Streams\Platform\Ui\Table\Event\TableIsQuerying($builder, $query));

TableWasQuerying

This event is fired at the end of the query process for table builders. The event contains the table builder instance and the query builder object.

app('events')->dispatch(new \Anomaly\Streams\Platform\Ui\Table\Event\TableWasQuerying($builder, $query));

Tree Builders

TreeIsQuerying

This event is fired at the beginning of the query process for tree (list) builders. The event contains the tree builder instance and the query builder object.

app('events')->dispatch(new \Anomaly\Streams\Platform\Ui\Tree\Event\TreeIsQuerying($builder, $query));

Entry Models

EntryWasCreated

This event is fired just after an entry is created. The event contains the entry that was created.

app('events')->dispatch(new \Anomaly\Streams\Platform\Entry\Event\EntryWasCreated($entry));

EntryWasUpdated

This event is fired just after an entry is updated. The event contains the entry that was updated.

app('events')->dispatch(new \Anomaly\Streams\Platform\Entry\Event\EntryWasUpdated($entry));

EntryWasSaved

This event is fired just after an entry is saved (created or updated). The event contains the entry that was saved.

app('events')->dispatch(new \Anomaly\Streams\Platform\Entry\Event\EntryWasSaved($entry));

EntryWasDeleted

This event is fired just after an entry is deleted. The event contains the entry that was deleted.

app('events')->dispatch(new \Anomaly\Streams\Platform\Entry\Event\EntryWasDeleted($entry));

This event is fired both when entries are deleted and trashed. You can use the isForceDeleting() method to check if the entry is being trashed or (force) deleted:

public function handle(EntryWasDeleted $event) {
    $entry = $event->getEntry();
    
    if ($entry->isForceDeleting()) {
        // Row was deleted.
    } else {
        // Row was trashed.
    }
}

EntryWasRestored

This event is fired just after a trashed entry is restored. The event contains the entry that was restored.

app('events')->dispatch(new \Anomaly\Streams\Platform\Entry\Event\EntryWasRestored($entry));

Eloquent Models

ModelWasCreated

This event is fired just after an model is created. The event contains the model that was created.

app('events')->dispatch(new \Anomaly\Streams\Platform\Model\Event\ModelWasCreated($model));

ModelWasUpdated

This event is fired just after an model is updated. The event contains the model that was updated.

app('events')->dispatch(new \Anomaly\Streams\Platform\Model\Event\ModelWasUpdated($model));

ModelsWereUpdated

This event is fired just after models are updated. The event contains the model associated with those that were updated.

app('events')->dispatch(new \Anomaly\Streams\Platform\Model\Event\ModelsWereUpdated($model));

ModelWasSaved

This event is fired just after an model is saved (created or updated). The event contains the model that was saved.

app('events')->dispatch(new \Anomaly\Streams\Platform\Model\Event\ModelWasSaved($model));

ModelWasDeleted

This event is fired just after an model is deleted. The event contains the model that was deleted.

app('events')->dispatch(new \Anomaly\Streams\Platform\Model\Event\ModelWasDeleted($model));

This event is fired both when entries are deleted and trashed. You can use the isForceDeleting() method to check if the model is being trashed or (force) deleted:

public function handle(ModelWasDeleted $event) {
    $model = $event->getModel();
    
    if ($model->isForceDeleting()) {
        // Row was deleted.
    } else {
        // Row was trashed.
    }
}

ModelsWereDeleted

This event is fired just after multiple models are deleted. The event contains the model associated to the deleted models.

app('events')->dispatch(new \Anomaly\Streams\Platform\Model\Event\ModelsWereDeleted($model));

This event is fired both when entries are deleted and trashed. You can use the isForceDeleting() method to check if the model is being trashed or (force) deleted:

public function handle(ModelsWereDeleted $event) {
    $model = $event->getModel();
    
    if ($model->isForceDeleting()) {
        // Rows were deleting.
    } else {
        // Rows were being trashed.
    }
}

ModelWasRestored

This event is fired just after a trashed model is restored. The event contains the model that was restored.

app('events')->dispatch(new \Anomaly\Streams\Platform\Model\Event\ModelWasRestored($model));