/** * 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 a feed of all issues. * * @param \Gitamin\Models\Owner|null $owner * @param bool $isRss * * @return \Illuminate\Http\Response */ private function feedAction(Owner &$owner, $isRss) { if ($owner->exists) { $owner->projects->map(function ($project) { $project->issues()->visible()->orderBy('created_at', 'desc')->get()->map(function ($issue) use($isRss) { $this->feedAddItem($issue, $isRss); }); }); } else { Issue::visible()->orderBy('created_at', 'desc')->get()->map(function ($issue) use($isRss) { $this->feedAddItem($issue, $isRss); }); } return $this->feed->render($isRss ? 'rss' : 'atom'); }
/** * Generates an Atom feed of all issues. * * @param \Gitamin\Models\ProjectTeam|null $namespace * * @return \Illuminate\Http\Response */ public function feedAction(ProjectNamespace $namespace = null) { if ($namespace->exists) { $namespace->projects->map(function ($project) { $project->issues()->visible()->orderBy('created_at', 'desc')->get()->map(function ($issue) { $this->feedAddItem($issue); }); }); } else { Issue::visible()->orderBy('created_at', 'desc')->get()->map(function ($issue) { $this->feedAddItem($issue); }); } return $this->feed->render($this->isRss ? 'rss' : 'atom'); }