public function show($id, Feed $feed) { $episode = $feed->articles->sortBy(function ($episode, $key) { return new Carbon($episode->pubDate); })->values()->get($id - 1); if ($episode == null) { abort(404); } return view('episodes.show')->with('podcast', $feed->info())->with('pageTitle', $episode->title)->with('episode', $episode); }
public function parse($xml) { if (!$xml instanceof SimpleXMLElement) { throw new InvalidXMLException(); } if (!isset($xml->channel->item)) { throw new InvalidFeedContentException(); } return Feed::make((array) $xml->channel); }
public function __construct(Feed $feed) { $this->info = $feed->info(); $this->buildArticles($feed->articles); }