本文整理匯總了PHP中CachetHQ\Cachet\Models\Incident::visible方法的典型用法代碼示例。如果您正苦於以下問題:PHP Incident::visible方法的具體用法?PHP Incident::visible怎麽用?PHP Incident::visible使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類CachetHQ\Cachet\Models\Incident
的用法示例。
在下文中一共展示了Incident::visible方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: feedAction
/**
* Generates a Rss feed of all incidents.
*
* @param \CachetHQ\Cachet\Models\ComponentGroup|null $group
* @param bool $isRss
*
* @return \Illuminate\Http\Response
*/
private function feedAction(ComponentGroup &$group, $isRss)
{
if ($group->exists) {
$group->components->map(function ($component) {
$component->incidents()->visible()->orderBy('created_at', 'desc')->get()->map(function ($incident) use($isRss) {
$this->feedAddItem($incident, $isRss);
});
});
} else {
Incident::visible()->orderBy('created_at', 'desc')->get()->map(function ($incident) use($isRss) {
$this->feedAddItem($incident, $isRss);
});
}
return $this->feed->render($isRss ? 'rss' : 'atom');
}
示例2: feedAction
/**
* Generates an Atom feed of all incidents.
*
* @param \CachetHQ\Cachet\Models\ComponentGroup|null $group
*
* @return \Illuminate\Http\Response
*/
public function feedAction(ComponentGroup $group = null)
{
$feed = Feed::make();
$feed->title = Setting::get('app_name');
$feed->description = trans('cachet.feed');
$feed->link = Str::canonicalize(Setting::get('app_domain'));
$feed->setDateFormat('datetime');
if ($group->exists) {
$group->components->map(function ($component) use($feed) {
$component->incidents()->visible()->orderBy('created_at', 'desc')->get()->map(function ($incident) use($feed) {
$this->feedAddItem($feed, $incident);
});
});
} else {
Incident::visible()->orderBy('created_at', 'desc')->get()->map(function ($incident) use($feed) {
$this->feedAddItem($feed, $incident);
});
}
return $feed->render('atom');
}