当前位置: 首页>>代码示例>>PHP>>正文


PHP Component::updating方法代码示例

本文整理汇总了PHP中CachetHQ\Cachet\Models\Component::updating方法的典型用法代码示例。如果您正苦于以下问题:PHP Component::updating方法的具体用法?PHP Component::updating怎么用?PHP Component::updating使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CachetHQ\Cachet\Models\Component的用法示例。


在下文中一共展示了Component::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();
     });
 }
开发者ID:mrbase,项目名称:cachet-slack-integration,代码行数:50,代码来源:ServiceProvider.php


注:本文中的CachetHQ\Cachet\Models\Component::updating方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。