public function show($id, RssFeed $feed) { $episode = $feed->articles->get($id); if ($episode == null) { abort(404); } return view('episodes.show')->with('podcast', $feed->info())->with('pageTitle', $episode->title)->with('episode', $episode)->with('episodeCount', $feed->articles->count()); }
/** * Execute the console command. * * @return mixed */ public function handle() { foreach (RssFeed::limit(1)->get() as $feed) { $response = $this->client->request('GET', $feed->url); $feed->html = $response->getBody()->getContents(); $feed->save(); } }
/** * Execute the console command. * * @return mixed */ public function handle() { $feed = FeedSource::first(); $response = $this->client->request('GET', $feed->url); $contents = $response->getBody()->getContents(); $xml = simplexml_load_string($contents); foreach ($xml->channel->item as $feed) { RssFeed::create(['url' => $feed->link, 'published_at' => Carbon::createFromFormat('D, d M Y H:i:s T', $feed->pubDate)]); } }
public function register() { $this->app->singleton(Feed::class, function ($app) { // @todo: Figure out how to cache without running into the simple xml issue // return app('cache')->remember('feed', $minutes = 1, function () { return (new Rss())->feed(config('customize.rss_url')); // }); }); $this->app->singleton(RssFeed::class, function ($app) { return RssFeed::fromFeed($app->make(Feed::class)); }); }
/** * Execute the console command. * * @return mixed */ public function handle() { foreach (RssFeed::limit(1)->get() as $feed) { $this->crawler->addContent($feed->html); foreach ($this->pointers as $key => $value) { try { $data[$key] = $this->crawler->filterXPath($value)->text(); } catch (\Exception $e) { $data[$key] = null; } } $data['url'] = $feed->url; $organisation = $this->saveOrganisation($data); $location = $this->saveLocation(); $organisation->location()->save($location); $vacancy = Vacancy::firstOrNew(['ref' => $data['ref']]); } }