Consume provides a collection of events for extending its functionality. Modules and plugins can register event listeners, typically in their init()
methods, to modify Consume’s behavior.
beforeSaveClient
event#The event that is triggered before a client is saved.
use verbb\consume\events\ClientEvent;
use verbb\consume\services\Clients;
use yii\base\Event;
Event::on(Clients::class, Clients::EVENT_BEFORE_SAVE_CLIENT, function(ClientEvent $event) {
$client = $event->client;
$isNew = $event->isNew;
// ...
});
afterSaveClient
event#The event that is triggered after a client is saved.
use verbb\consume\events\ClientEvent;
use verbb\consume\services\Clients;
use yii\base\Event;
Event::on(Clients::class, Clients::EVENT_AFTER_SAVE_CLIENT, function(ClientEvent $event) {
$client = $event->client;
$isNew = $event->isNew;
// ...
});
beforeDeleteClient
event#The event that is triggered before a client is deleted.
use verbb\consume\events\ClientEvent;
use verbb\consume\services\Clients;
use yii\base\Event;
Event::on(Clients::class, Clients::EVENT_BEFORE_DELETE_CLIENT, function(ClientEvent $event) {
$client = $event->client;
// ...
});
afterDeleteClient
event#The event that is triggered after a client is deleted.
use verbb\consume\events\ClientEvent;
use verbb\consume\services\Clients;
use yii\base\Event;
Event::on(Clients::class, Clients::EVENT_AFTER_DELETE_CLIENT, function(ClientEvent $event) {
$client = $event->client;
// ...
});