本文整理汇总了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']);
}
示例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');
}