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