show = $show; $this->episode = $episode; } /** * Returns count of show. * * @param array $filter * * @return int */ public function count() { return 0; } /** * Make gadget View * * @param string $view * * @param int $count * * @return View */ public function gadget($view = 'admin.show.gadget', $count = 10) { if (User::hasRole('user')) { $this->show->pushCriteria(new \Litepie\Futage\Repositories\Criteria\ShowUserCriteria()); } $show = $this->show->scopeQuery(function ($query) use ($count) { return $query->orderBy('id', 'DESC')->take($count); })->all(); return view('show::' . $view, compact('show'))->render(); } /** * Make gadget View * * @param string $view * * @param int $count * * @return View */ public function gadget($view = 'admin.episode.gadget', $count = 10) { if (User::hasRole('user')) { $this->episode->pushCriteria(new \Litepie\Futage\Repositories\Criteria\EpisodeUserCriteria()); } $episode = $this->episode->scopeQuery(function ($query) use ($count) { return $query->orderBy('id', 'DESC')->take($count); })->all(); return view('show::' . $view, compact('episode'))->render(); } }