예제 #1
0
 private function passData($id = null)
 {
     $people = new \App\Models\People();
     $address = new \App\Models\Addresses();
     $employee = new \App\Models\Employee();
     if (!is_null($id)) {
         $people = People::findOrNew($id);
         $universityHisttory = $people->universityHistory()->get();
         $careerHistory = $people->careerHistory()->get();
         $employee = $people->employee()->first();
         if ($people->address()->first()) {
             $address = $people->address()->get()->first();
         }
     } else {
         if (!Session::has('UniversityHistory')) {
             Session::set('UniversityHistory', $people->universityHistory()->get());
         }
         if (!Session::has('CareerHistory')) {
             Session::set('CareerHistory', $people->careerHistory()->get());
         }
         $universityHisttory = Session::get('UniversityHistory');
         $careerHistory = Session::get('CareerHistory');
     }
     $pTitle = PeopleTitle::all()->sortBy("Title_Name")->toArray();
     foreach ($pTitle as $peopTitle) {
         $peopleTitle[$peopTitle["id_People_Title"]] = $peopTitle["Title_Name"];
     }
     $employeeType = EmployeeType::getEmployeeTypeOptions();
     $countryModel = $address->getCountry();
     $regionsOptions = Region::getRegionsOptions();
     $countryOptions = Country::getCountriesOptionsByRegion($countryModel->id_Region);
     return compact("countryOptions", "regionsOptions", "employeeType", "people", "peopleTitle", "universityHisttory", "careerHistory", "employee", "address");
 }
 public function edit($id)
 {
     $employee = Employee::find($id);
     $types = EmployeeType::getType();
     return view('pages.edit_employee', ['employee' => $employee, 'types' => $types]);
 }