hall = $hall; $this->line = $line; $this->equipment = $equipment; $this->department = $department; $this->employees = $employees; $this->department_role = $department_role; } /** * Returns count of company_structure. * * @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.hall.gadget', $count = 10) { if (User::hasRole('user')) { $this->hall->pushCriteria(new \Litepie\Company\Repositories\Criteria\HallUserCriteria()); } $hall = $this->hall->scopeQuery(function ($query) use ($count) { return $query->orderBy('id', 'DESC')->take($count); })->all(); return view('company_structure::' . $view, compact('hall'))->render(); } /** * Make gadget View * * @param string $view * * @param int $count * * @return View */ public function gadget($view = 'admin.line.gadget', $count = 10) { if (User::hasRole('user')) { $this->line->pushCriteria(new \Litepie\Company\Repositories\Criteria\LineUserCriteria()); } $line = $this->line->scopeQuery(function ($query) use ($count) { return $query->orderBy('id', 'DESC')->take($count); })->all(); return view('company_structure::' . $view, compact('line'))->render(); } /** * Make gadget View * * @param string $view * * @param int $count * * @return View */ public function gadget($view = 'admin.equipment.gadget', $count = 10) { if (User::hasRole('user')) { $this->equipment->pushCriteria(new \Litepie\Company\Repositories\Criteria\EquipmentUserCriteria()); } $equipment = $this->equipment->scopeQuery(function ($query) use ($count) { return $query->orderBy('id', 'DESC')->take($count); })->all(); return view('company_structure::' . $view, compact('equipment'))->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\Company\Repositories\Criteria\DepartmentUserCriteria()); } $department = $this->department->scopeQuery(function ($query) use ($count) { return $query->orderBy('id', 'DESC')->take($count); })->all(); return view('company_structure::' . $view, compact('department'))->render(); } /** * Make gadget View * * @param string $view * * @param int $count * * @return View */ public function gadget($view = 'admin.employees.gadget', $count = 10) { if (User::hasRole('user')) { $this->employees->pushCriteria(new \Litepie\Company\Repositories\Criteria\EmployeesUserCriteria()); } $employees = $this->employees->scopeQuery(function ($query) use ($count) { return $query->orderBy('id', 'DESC')->take($count); })->all(); return view('company_structure::' . $view, compact('employees'))->render(); } /** * Make gadget View * * @param string $view * * @param int $count * * @return View */ public function gadget($view = 'admin.department_role.gadget', $count = 10) { if (User::hasRole('user')) { $this->department_role->pushCriteria(new \Litepie\Company\Repositories\Criteria\DepartmentRoleUserCriteria()); } $department_role = $this->department_role->scopeQuery(function ($query) use ($count) { return $query->orderBy('id', 'DESC')->take($count); })->all(); return view('company_structure::' . $view, compact('department_role'))->render(); } }