/** * 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'); }
/** * 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'); }