settings = $settingsService;
$this->pages = $pageRepo;
}
public function getFeed(Request $request)
{
$pages = $this->pages->getAll();
$global = $this->settings->getGlobal();
$feedContent = "
{$global['title']}
{$global['base_url']}
Feed @ {$global['title']}
en-us";
// Loop over the content and add it to the feed
foreach ($pages as $item) {
$title = urldecode($item['title']);
$html = urldecode($item['html']);
$updatedAt = Carbon::parse($item['rawUpdated']);
$date = $updatedAt->format('D, d M Y H:i:s O');
$link = $global['base_url'] . "/" . $item['path'] . "/" . $item['slug'];
if ($global['dynamicRender'] != "true") {
$link = $link . ".html";
}
//grabs feature image or vid and tosses it in the description
$media = explode(",", $item['feature']);
$file = '';
if ($media[0] == null || $media[0] == '') {
$file = $global['background'];
} else {
$file = $media[0];
}
$ext = pathinfo($file, PATHINFO_EXTENSION);
$url = $global['base_url'] . $file;
if ($ext != 'mp4') {
$top = "
";
} else {
$top = " ";
}
$feedContent .= "
-
{$title}
{$link}
{$global['base_url']}/rss/feed/item/{$item['uuid']}
{$date}
]]>
";
}
$feedContent .= "
";
return response($feedContent, 200)->header('Content-Type', 'application/rss+xml');
/**
//set up feed info
header("Content-Type: text/xml");
echo("");
echo("");
echo("");
echo("" . $global['title'] . "");
echo("" . $global['base_url'] . "");
echo("The Feed for " . $global['title'] . "");
//item loop start
foreach ($pages as $item) {
echo("- ");
echo("" . urldecode($item['title']) . "");
echo("" . $global['base_url'] . "/rss/feed/item/" . $item['uuid'] . "");
echo("" . $global['base_url'] . "/rss/feed/item/" . $item['uuid'] . "");
echo("" . $item['updated'] . "");
echo("" . $item['created'] . "");
echo(" ");
echo("" . $item['author'] . "");
echo("
");
}
//item loop end
//close it up
echo("");
echo("");
**/
}
}