Пример #1
0
 public function scopeGenres10($query)
 {
     $order = Helpers::getOrdering();
     $genre10 = $query->where('now_playing', 1)->limit(10)->orderBy($order, 'desc')->get();
     if ($this->options->getDataProvider() == 'db' || !$this->options->autoUpdateData()) {
         return $genre10;
     }
     if ($genre10->isEmpty() || $genre10->first()->updated_at->addDays(2) <= Carbon::now()) {
         $genre10 = $this->updatePlaying($order);
     }
     return $genre10;
 }
Пример #2
0
 /**
  * Checks if given title needs to be fully scraped.
  * 
  * @param  Title  $title
  * @return boolean
  */
 public function needsScraping(Title $title)
 {
     $needs = true;
     //first check for fully_scraped flag, if its true
     //we wont update
     if ($title->fully_scraped) {
         $needs = false;
     }
     //next check if it was 5 days  since last update
     //if so we'll update title now
     if (!$title->updated_at || $title->updated_at->addDays(5) <= Carbon::now() && $this->options->autoUpdateData()) {
         $needs = true;
     }
     $date = date('Y-m-d', strtotime($title->release_date));
     if ($title->review->isEmpty() && $date < Carbon::now()->toDateString()) {
         $needs = true;
     }
     //finally check for provider and if we're allowed to update
     //the title
     if ($this->provider->name == 'db' || !$title->allow_update) {
         return false;
     }
     return $needs;
 }