employees = $employees; $this->benefits = $benefits; $this->dependents = $dependents; $this->leaves = $leaves; $this->salary_history = $salary_history; $this->attendance = $attendance; $this->newjoinee = $newjoinee; } /** * Returns count of employee. * * @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.employees.gadget', $count = 10) { if (User::hasRole('user')) { $this->employees->pushCriteria(new \Litepie\Bixo\Repositories\Criteria\EmployeesUserCriteria()); } $employees = $this->employees->scopeQuery(function ($query) use ($count) { return $query->orderBy('id', 'DESC')->take($count); })->all(); return view('employee::' . $view, compact('employees'))->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('employee::' . $view, compact('benefits'))->render(); } /** * Make gadget View * * @param string $view * * @param int $count * * @return View */ public function gadget($view = 'admin.dependents.gadget', $count = 10) { if (User::hasRole('user')) { $this->dependents->pushCriteria(new \Litepie\Bixo\Repositories\Criteria\DependentsUserCriteria()); } $dependents = $this->dependents->scopeQuery(function ($query) use ($count) { return $query->orderBy('id', 'DESC')->take($count); })->all(); return view('employee::' . $view, compact('dependents'))->render(); } /** * Make gadget View * * @param string $view * * @param int $count * * @return View */ public function gadget($view = 'admin.leaves.gadget', $count = 10) { if (User::hasRole('user')) { $this->leaves->pushCriteria(new \Litepie\Bixo\Repositories\Criteria\LeavesUserCriteria()); } $leaves = $this->leaves->scopeQuery(function ($query) use ($count) { return $query->orderBy('id', 'DESC')->take($count); })->all(); return view('employee::' . $view, compact('leaves'))->render(); } /** * Make gadget View * * @param string $view * * @param int $count * * @return View */ public function gadget($view = 'admin.salary_history.gadget', $count = 10) { if (User::hasRole('user')) { $this->salary_history->pushCriteria(new \Litepie\Bixo\Repositories\Criteria\SalaryHistoryUserCriteria()); } $salary_history = $this->salary_history->scopeQuery(function ($query) use ($count) { return $query->orderBy('id', 'DESC')->take($count); })->all(); return view('employee::' . $view, compact('salary_history'))->render(); } /** * Make gadget View * * @param string $view * * @param int $count * * @return View */ public function gadget($view = 'admin.attendance.gadget', $count = 10) { if (User::hasRole('user')) { $this->attendance->pushCriteria(new \Litepie\Bixo\Repositories\Criteria\AttendanceUserCriteria()); } $attendance = $this->attendance->scopeQuery(function ($query) use ($count) { return $query->orderBy('id', 'DESC')->take($count); })->all(); return view('employee::' . $view, compact('attendance'))->render(); } /** * Make gadget View * * @param string $view * * @param int $count * * @return View */ public function gadget($view = 'admin.newjoinee.gadget', $count = 10) { if (User::hasRole('user')) { $this->newjoinee->pushCriteria(new \Litepie\Bixo\Repositories\Criteria\NewjoineeUserCriteria()); } $newjoinee = $this->newjoinee->scopeQuery(function ($query) use ($count) { return $query->orderBy('id', 'DESC')->take($count); })->all(); return view('employee::' . $view, compact('newjoinee'))->render(); } }