first(); // Artists that are 'done' can be run through the queue again. Prevent in progress, though. if ($artist_id->count() > 0 && $artist_id->state !== 'in_progress') { $this->artist_id = $artist_id->id; $this->save(); $artist_id->change_state('in_progress'); $result = true; } return $result; } public function process_artist() { // Scrape the artist page for image, and album data (image, url, name) $driver = WebDriver::setUp(); $artist_id = Artist::where('id', $this->artist_id)->get()->first(); if ($artist_id->count() > 0) { try { WebScraper::scrapeAlbums($driver, $artist_id); } catch (Exception $e) { \Log::warning('Failed to scrape albums: ' . $e->getMessage()); } finally { $driver->quit(); } } else { throw new Exception('The Artist ID provided to the queue does not exist.'); } } }