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