Example #1
0
 /**
  * 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)]);
     }
 }