本文整理汇总了PHP中CachetHQ\Cachet\Models\Incident::updating方法的典型用法代码示例。如果您正苦于以下问题:PHP Incident::updating方法的具体用法?PHP Incident::updating怎么用?PHP Incident::updating使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CachetHQ\Cachet\Models\Incident
的用法示例。
在下文中一共展示了Incident::updating方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: boot
/**
* @param DispatcherContract $events
*/
public function boot(DispatcherContract $events)
{
if (false === config('slack.endpoint', false)) {
return;
}
$this->loadTranslationsFrom(__DIR__ . '/resources/lang', 'slack');
/**
* To get the actual changes we need to record the
* changes before the Cachet event is fired.
*/
Incident::updating(function (Incident $incident) {
$dirty = [];
foreach ($incident->getDirty() as $key => $v) {
$dirty[$key] = $incident->getOriginal($key);
}
self::registerChanges('incident', $dirty);
});
Component::updating(function (Component $component) {
$dirty = [];
foreach ($component->getDirty() as $key => $v) {
$dirty[$key] = $component->getOriginal($key);
}
self::registerChanges('component', $dirty);
});
/**
* Send Slack notification on new incidents.
*/
$events->listen('CachetHQ\\Cachet\\Bus\\Events\\Incident\\IncidentWasReportedEvent', function (IncidentWasReportedEvent $event) {
$handler = new IncidentWasReportedHandler($event->incident->status, $event->incident->name, $event->incident->message, $event->incident['component_id']);
return $handler->send();
});
/**
* Send Slack notification on incident updates.
*/
$events->listen('CachetHQ\\Cachet\\Bus\\Events\\Incident\\IncidentWasUpdatedEvent', function (IncidentWasUpdatedEvent $event) {
$handler = new IncidentWasUpdatedHandler($event->incident->id, $event->incident->status, $event->incident->name, $event->incident->message, $event->incident['component_id'], self::getChanges('incident'));
return $handler->send();
});
/**
* Send Slack notification on component updates.
* Note these are not send when a component is updated as part of an incident update.
*/
$events->listen('CachetHQ\\Cachet\\Bus\\Events\\Component\\ComponentWasUpdatedEvent', function (ComponentWasUpdatedEvent $event) {
$handler = new ComponentWasUpdatedHandler($event->component->status, $event->component->name);
return $handler->send();
});
}