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