當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Incident::get方法代碼示例

本文整理匯總了PHP中CachetHQ\Cachet\Models\Incident::get方法的典型用法代碼示例。如果您正苦於以下問題:PHP Incident::get方法的具體用法?PHP Incident::get怎麽用?PHP Incident::get使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在CachetHQ\Cachet\Models\Incident的用法示例。


在下文中一共展示了Incident::get方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: feedAction

 /**
  * Generates an RSS feed of all incidents.
  *
  * @return \Illuminate\Http\Response
  */
 public function feedAction()
 {
     $feed = RssFacade::feed('2.0', 'UTF-8');
     $feed->channel(['title' => Setting::get('app_name'), 'description' => 'Status Feed', 'link' => Setting::get('app_domain')]);
     Incident::get()->map(function ($incident) use($feed) {
         if ($incident->component) {
             $componentName = $incident->component->name;
         } else {
             $componentName = null;
         }
         $feed->item(['title' => $incident->name, 'message' => $incident->message, 'component' => $componentName, 'status' => $incident->humanStatus, 'created_at' => $incident->created_at, 'updated_at' => $incident->updated_at]);
     });
     return Response::make($feed, 200, ['Content-Type' => 'text/xml']);
 }
開發者ID:baa-archieve,項目名稱:Cachet,代碼行數:19,代碼來源:RssController.php

示例2: feedAction

 /**
  * Generates an Atom feed of all incidents.
  *
  * @return \Illuminate\Http\Response
  */
 public function feedAction()
 {
     $feed = Feed::make();
     $feed->title = Setting::get('app_name');
     $feed->description = 'Status Feed';
     $feed->link = Setting::get('app_domain');
     $feed->setDateFormat('datetime');
     Incident::get()->map(function ($incident) use($feed) {
         if ($incident->component) {
             $componentName = $incident->component->name;
         } else {
             $componentName = null;
         }
         $feed->add($incident->name, Setting::get('app_name'), Setting::get('app_domain'), $incident->created_at, $componentName === null ? $incident->humanStatus : $componentName . " " . $incident->humanStatus, $incident->message);
     });
     return $feed->render('atom');
 }
開發者ID:baa-archieve,項目名稱:Cachet,代碼行數:22,代碼來源:AtomController.php


注:本文中的CachetHQ\Cachet\Models\Incident::get方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。