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