/** * Searches for a title by query, inserts and returns it. * * @param string $query * @return array */ public function byQuery($query) { $url = $this->compileSearchUrl($query); //scrape and compile results for display in view $results = $this->scraper->curl($url); $compiled = $this->compileSearchResults($results); Event::fire('App.SearchResultsCompiled', array($compiled)); return $this->writer->insertFromImdbSearch($compiled); }
/** * Inserts single seasons eps and returns title with everything. * * @param array $season * @param int $id * @return Collection */ public function saveEpisodes(array $season, $id) { $this->dbWriter->CompileBatchInsert('episodes', $season)->save(); return Title::whereId($id)->with('Writer', 'Director', 'Actor', 'Image', 'Review', 'Season.Episode')->first(); }