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