Ejemplo n.º 1
0
 /**
  * Set components state based on parameters
  *
  * @throws ModelNotFoundException
  */
 public function setState()
 {
     $this->show = $this->loadShow();
     if ($this->property('tagSlug')) {
         $this->tag = Tag::query()->where('slug', $this->property('tagSlug'))->firstOrFail();
     }
     $this->episode = $this->loadEpisode();
     $this->releases = Collection::make($this->episode->releases);
     // Creates a copy
     $this->releases->sort(function (Release $a, Release $b) {
         // Order by the sort_order column
         $aRating = $a->release_type->sort_order;
         $bRating = $b->release_type->sort_order;
         return $aRating - $bRating;
     });
 }