Exemplo n.º 1
0
 public function units()
 {
     if (Session::has('username') && (Session::get('user_type') == "Root" || Session::get('user_type') == "Admin")) {
         $view = View::make('Settings.Employees.settings_units');
         $view->nav = "system";
         $view->tab = "units";
         $view->units = Unit::orderBy("name")->paginate(50);
         return $view;
     } else {
         return Redirect::to("/");
     }
 }
Exemplo n.º 2
0
 public function updateEmployee($id)
 {
     if (Session::has('username') && (Session::get('user_type') == "Root" || Session::get('user_type') == "Admin")) {
         $view = View::make('Employees.update_employee');
         $employee = Employee::where("employee_number", "=", $id)->first();
         if (!$employee) {
             return Redirect::to('employees');
         }
         $view->employee = $employee;
         $getManagers = Manager::orderBy('last_name', 'asc')->get();
         $managers = array("" => "None");
         foreach ($getManagers as $manager) {
             if (!empty($manager["first_name"])) {
                 $managers[$manager["id"]] = $manager["last_name"] . ", " . $manager["first_name"];
             } else {
                 $managers[$manager["id"]] = $manager["last_name"];
             }
         }
         $getBusinessLines = BusinessLine::all();
         $businessLines = array("" => "None");
         foreach ($getBusinessLines as $businessLine) {
             $businessLines[$businessLine["id"]] = $businessLine["name"];
         }
         $getUnits = Unit::orderBy("name", "asc")->get();
         $units = array("" => "None");
         foreach ($getUnits as $unit) {
             $units[$unit["id"]] = $unit["name"];
         }
         $view->managers = $managers;
         $view->businessLines = $businessLines;
         $view->units = $units;
         $view->nav = "employees";
         return $view;
     } else {
         return Redirect::to('/');
     }
 }