/** * Get podcast from feed. * Create new podcast if necessary. * * @param string $feed * @return Podcast */ public static function getOrCreateFromRss($feed) { $created = false; $podcast = Podcast::where('feed', $feed)->first(); if (!$podcast) { $podcast = new Podcast(); $podcast->feed = $feed; $podcast->coverimage = '/assets/default.png'; $podcast->save(); // load feed details asynchronously dispatch(new UpdatePodcastFromRss($podcast)); $created = true; } return $podcast; }