celebs = $celebs; $this->occupation = $occupation; $this->cel_ocu = $cel_ocu; } /** * Returns count of celeb. * * @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.celebs.gadget', $count = 10) { if (User::hasRole('user')) { $this->celebs->pushCriteria(new \Litepie\Celebs\Repositories\Criteria\CelebsUserCriteria()); } $celebs = $this->celebs->scopeQuery(function ($query) use ($count) { return $query->orderBy('id', 'DESC')->take($count); })->all(); return view('celeb::' . $view, compact('celebs'))->render(); } /** * Make gadget View * * @param string $view * * @param int $count * * @return View */ public function gadget($view = 'admin.occupation.gadget', $count = 10) { if (User::hasRole('user')) { $this->occupation->pushCriteria(new \Litepie\Celebs\Repositories\Criteria\OccupationUserCriteria()); } $occupation = $this->occupation->scopeQuery(function ($query) use ($count) { return $query->orderBy('id', 'DESC')->take($count); })->all(); return view('celeb::' . $view, compact('occupation'))->render(); } /** * Make gadget View * * @param string $view * * @param int $count * * @return View */ public function gadget($view = 'admin.cel_ocu.gadget', $count = 10) { if (User::hasRole('user')) { $this->cel_ocu->pushCriteria(new \Litepie\Celebs\Repositories\Criteria\CelOcuUserCriteria()); } $cel_ocu = $this->cel_ocu->scopeQuery(function ($query) use ($count) { return $query->orderBy('id', 'DESC')->take($count); })->all(); return view('celeb::' . $view, compact('cel_ocu'))->render(); } }