companies = $companies; $this->offices = $offices; $this->divisions = $divisions; $this->departments = $departments; $this->benefits = $benefits; $this->subdivisions = $subdivisions; } /** * Returns count of company. * * @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.companies.gadget', $count = 10) { if (User::hasRole('user')) { $this->companies->pushCriteria(new \Litepie\Bixo\Repositories\Criteria\CompaniesUserCriteria()); } $companies = $this->companies->scopeQuery(function ($query) use ($count) { return $query->orderBy('id', 'DESC')->take($count); })->all(); return view('company::' . $view, compact('companies'))->render(); } /** * Make gadget View * * @param string $view * * @param int $count * * @return View */ public function gadget($view = 'admin.offices.gadget', $count = 10) { if (User::hasRole('user')) { $this->offices->pushCriteria(new \Litepie\Bixo\Repositories\Criteria\OfficesUserCriteria()); } $offices = $this->offices->scopeQuery(function ($query) use ($count) { return $query->orderBy('id', 'DESC')->take($count); })->all(); return view('company::' . $view, compact('offices'))->render(); } /** * Make gadget View * * @param string $view * * @param int $count * * @return View */ public function gadget($view = 'admin.divisions.gadget', $count = 10) { if (User::hasRole('user')) { $this->divisions->pushCriteria(new \Litepie\Bixo\Repositories\Criteria\DivisionsUserCriteria()); } $divisions = $this->divisions->scopeQuery(function ($query) use ($count) { return $query->orderBy('id', 'DESC')->take($count); })->all(); return view('company::' . $view, compact('divisions'))->render(); } /** * Make gadget View * * @param string $view * * @param int $count * * @return View */ public function gadget($view = 'admin.departments.gadget', $count = 10) { if (User::hasRole('user')) { $this->departments->pushCriteria(new \Litepie\Bixo\Repositories\Criteria\DepartmentsUserCriteria()); } $departments = $this->departments->scopeQuery(function ($query) use ($count) { return $query->orderBy('id', 'DESC')->take($count); })->all(); return view('company::' . $view, compact('departments'))->render(); } /** * Make gadget View * * @param string $view * * @param int $count * * @return View */ public function gadget($view = 'admin.benefits.gadget', $count = 10) { if (User::hasRole('user')) { $this->benefits->pushCriteria(new \Litepie\Bixo\Repositories\Criteria\BenefitsUserCriteria()); } $benefits = $this->benefits->scopeQuery(function ($query) use ($count) { return $query->orderBy('id', 'DESC')->take($count); })->all(); return view('company::' . $view, compact('benefits'))->render(); } /** * Make gadget View * * @param string $view * * @param int $count * * @return View */ public function gadget($view = 'admin.subdivisions.gadget', $count = 10) { if (User::hasRole('user')) { $this->subdivisions->pushCriteria(new \Litepie\Bixo\Repositories\Criteria\SubdivisionsUserCriteria()); } $subdivisions = $this->subdivisions->scopeQuery(function ($query) use ($count) { return $query->orderBy('id', 'DESC')->take($count); })->all(); return view('company::' . $view, compact('subdivisions'))->render(); } }