コード例 #1
0
 function save(array $params)
 {
     $response = new ResponseEntity();
     try {
         $user = new User();
         $user->email = $params['email'];
         $user->password = bcrypt($params['password']);
         $user->status = 'ACTIVE';
         $user->save();
         $employee = new Employee();
         $employee->user_id = 10;
         $employee->employee_id = Config::get('hris_system.employee_id_prefix') . 10;
         $employee->first_name = $params['first_name'];
         $employee->last_name = $params['last_name'];
         $employee->middle_name = $params['middle_name'];
         $employee->sex = $params['sex'];
         $employee->birthday = '1990-11-20';
         $employee->department_id = $params['department_id'];
         $employee->position_id = $params['position_id'];
         $ok = $employee->save();
         if ($ok) {
             $response->setSuccess(true);
             $response->setMessages(['Employee successfully created!']);
         } else {
             $response->setMessages(['Failed to create employee!']);
         }
     } catch (\Exception $ex) {
         $response->setMessages([$ex->getMessage()]);
     }
     return $response;
 }
コード例 #2
0
 /**
  * Creates a new Employee model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  * @return mixed
  */
 public function actionCreate()
 {
     $model = new Employee();
     if ($model->load(Yii::$app->request->post()) && $model->save()) {
         return $this->redirect(['view', 'id' => $model->id]);
     } else {
         return $this->render('create', ['model' => $model]);
     }
 }
コード例 #3
0
 public function actionCreate()
 {
     $model = new Employee();
     $model->attributes = $_POST['Employee'];
     if ($model->save()) {
         Yii::$app->getSession()->setFlash('success', 'Employee has been added successfully');
         return $this->redirect(['index']);
     }
 }
コード例 #4
0
 /**
  * Creates a new Employee model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  * @return mixed
  */
 public function actionCreate()
 {
     $model = new Employee();
     if ($model->load(Yii::$app->request->post()) && $model->save()) {
         $model->password = md5($email + $password);
         return $this->redirect(['view', 'employee_id' => $model->employee_id, 'position_id' => $model->position_id]);
     } else {
         return $this->render('create', ['model' => $model]);
     }
 }
コード例 #5
0
 /**
  * Creates a new Employee model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  * @return mixed
  */
 public function actionCreate()
 {
     $model = new Employee();
     if ($model->load(Yii::$app->request->post()) && ($res = $model->save())) {
         $this->set_service_info($model->id, $_REQUEST['service_data']);
         return $this->redirect(['update', 'id' => $model->id]);
     } else {
         return $this->render('create', ['model' => $model, 'data_set' => $this->get_service_info()]);
     }
 }
コード例 #6
0
 /**
  * Creates a new Employee model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  * @return mixed
  */
 public function actionCreate()
 {
     $model = new Employee();
     $section_array = $this->getAllSection();
     $model->beforeSave(true);
     if ($model->load(Yii::$app->request->post()) && $model->save()) {
         return $this->redirect(['view', 'id' => $model->id]);
     } else {
         return $this->render('create', ['model' => $model, 'section_array' => $section_array]);
     }
 }
コード例 #7
0
 /**
  * Store a newly created resource in storage.
  *
  * @return Response
  */
 public function store($personId)
 {
     $person = GuestHistory::find($personId);
     if ($person) {
         $employee = new Employee();
         $employee->fill(Input::all());
         $employee->guesthistory()->associate($person);
         $employee->save();
     } else {
         return null;
     }
     return $person;
 }
コード例 #8
0
 /**
  * Store a newly created resource in storage.
  *
  * @return Response
  */
 public function store()
 {
     // return Input::all();
     $name_father = Input::get('datafather.father_name');
     $surname_father = Input::get('datafather.father_surname');
     $name_mother = Input::get('datamother.mother_name');
     $surname_mother = Input::get('datamother.mother_surname');
     $name_spouse = Input::get('dataspouse.spouse_name');
     $surname_spouse = Input::get('dataspouse.spouse_surname');
     $present_address = Input::get('addresspresent.present_address');
     $original_address = Input::get('addressoriginal.original_address');
     if (Auth::check()) {
         $IdPolice = Auth::user()->id;
     }
     if ($present_address != null) {
         $addresspresent = new AddressPresent();
         $addresspresent->fill(Input::get('addresspresent'));
         $addresspresent->save();
     }
     if ($original_address != null) {
         $addressoriginal = new AddressOriginal();
         $addressoriginal->fill(Input::get('addressoriginal'));
         $addressoriginal->save();
     }
     if ($name_mother != null || $surname_mother != null) {
         $datamother = new DataMother();
         $datamother->fill(Input::get('datamother'));
         $datamother->save();
     }
     if ($name_father != null || $surname_father != null) {
         $datafather = new DataFather();
         $datafather->fill(Input::get('datafather'));
         $datafather->save();
     }
     if ($name_spouse != null || $surname_spouse != null) {
         $dataspouse = new DataSpouse();
         $dataspouse->fill(Input::get('dataspouse'));
         $dataspouse->save();
     }
     $guesthistory = new GuestHistory();
     $guesthistory->fill(Input::except(["addressoffice", "child", "employee", "family", "vehicle", "datamother", "dataspouse", "addressoriginal", "addresspresent", "datafather"]));
     if ($datamother != null) {
         $guesthistory->datamother()->associate($datamother);
     }
     if ($datafather != null) {
         $guesthistory->datafather()->associate($datafather);
     }
     if ($dataspouse != null) {
         $guesthistory->dataspouse()->associate($dataspouse);
     }
     if ($addressoriginal != null) {
         $guesthistory->addressoriginal()->associate($addressoriginal);
     }
     if ($addresspresent != null) {
         $guesthistory->addresspresent()->associate($addresspresent);
     }
     if ($IdPolice != null) {
         $police = Policeimmigration::find($IdPolice);
         $guesthistory->policeimmigration()->associate($police);
     }
     $guesthistory->save();
     $address_office = Input::get('addressoffice');
     $data_child = Input::get('datachild');
     $data_employee = Input::get('employee');
     $person_family = Input::get('personfamily');
     $data_vehicle = Input::get('vehicle');
     foreach ($data_employee as $dataemployee) {
         $employee = new \App\Models\Employee();
         $employee->fill($dataemployee);
         $employee->guesthistory()->associate($guesthistory);
         $employee->save();
     }
     foreach ($person_family as $datafamily) {
         $personfamily = new PersonFamily();
         $personfamily->fill($datafamily);
         $personfamily->guesthistory()->associate($guesthistory);
         $personfamily->save();
     }
     foreach ($data_vehicle as $datavehicle) {
         $vechicle = new \App\Models\Vehicle();
         $vechicle->fill($datavehicle);
         $vechicle->guesthistory()->associate($guesthistory);
         $vechicle->save();
     }
     foreach ($data_child as $child) {
         $datachild = new DataChild();
         $datachild->fill($child);
         $datachild->guesthistory()->associate($guesthistory);
         $datachild->save();
     }
     foreach ($address_office as $data_office) {
         $addressoffice = new AddressOffice();
         $addressoffice->fill($data_office);
         $addressoffice->guesthistory()->associate($guesthistory);
         $addressoffice->save();
     }
     Event::fire(new AddDataPersonGeneralEvent($guesthistory));
     return $guesthistory;
 }
コード例 #9
0
 public function getEmployeeCompanyRegister(Request $request)
 {
     $addEmployee = new Employee();
     $addEmployee->fullname = $request->input('fullname');
     $addEmployee->username = $request->input('username');
     $addEmployee->password = $request->input('password');
     $addEmployee->email = $request->input('email');
     $addEmployee->attribute = $request->input('attribute');
     if ($addEmployee->save()) {
         $result = array("result" => "success");
     } else {
         $result = array("result" => "failed");
     }
     $username = \Input::get('username');
     $password = \Input::get('password');
     $query = DB::table('Employee')->where('username', $username)->where('password', $password)->select('employeeId')->first();
     $addCompany = new Company();
     $addCompany->companyName = $request->input('companyName');
     $addCompany->generalAttributes = $request->input('generalAttributes');
     $addCompany->purposeAndTopic = $request->input('purposeAndTopic');
     $addCompany->companyCenterAndDepartment = $request->input('companyCenterAndDepartment');
     $addCompany->jobDescription = $request->input('jobDescription');
     $addCompany->companyAdress = $request->input('companyAdress');
     $addCompany->employeeCount = $request->input('employeeCount');
     $addCompany->companyMail = $request->input('companyMail');
     $addCompany->employeeId = $query->employeeId;
     if ($addCompany->save()) {
         $result = array("result" => "success");
     } else {
         $result = array("result" => "failed");
     }
     return \View::make('ajaxResult', $result);
 }
コード例 #10
0
 public function postEmployee(Request $request)
 {
     if (Session::get('member')->property_id != null) {
         if (Session::get('member')->type > 1) {
             return redirect()->back()->withErrors(['คุณไม่มีสิทธิ์เข้าใช้งานส่วนนี้'])->withInput();
         }
     }
     $messages = ['username.required' => 'กรุณาใส่ชื่อผู้ใช้', 'password.required' => 'กรุณาใส่รหัสผ่าน', 'name.required' => 'กรุณาใส่ชื่อจริงของพนักงาน', 'lastname.required' => 'กรุณาใส่นามสกุลของพนักงาน', 'email.required' => 'กรุณาใส่อีเมล์', 'tel.required' => 'กรุณาใส่เบอร์ติดต่อ', 'role.required' => 'กรุณาระบุบทบาทของพนักงาน', 'gender.required' => 'กรุณาระบุเพศของพนักงาน'];
     $validator = Validator::make($request->all(), ['username' => 'required', 'password' => 'required', 'name' => 'required', 'lastname' => 'required', 'email' => 'required', 'tel' => 'required', 'role' => 'required', 'gender' => 'required'], $messages);
     if (Session::has('property')) {
         if ($validator->fails()) {
             return redirect()->back()->withErrors($validator)->withInput();
         }
         $exist = Session::get('property')->employees()->where('username', '=', $request->username)->first();
         if ($exist) {
             return redirect()->back()->withErrors(['มีชื่อผู้ใช้ดังกล่าวในระบบพนักงานแล้ว'])->withInput();
         }
         $employee = new Employee();
         $employee->property_id = Session::get('property')->id;
         $employee->username = $request->username;
         $employee->password = Hash::make($request->password);
         $employee->type = $request->role;
         $employee->name = $request->name;
         $employee->lastname = $request->lastname;
         $employee->gender = $request->gender;
         $employee->tel = $request->tel;
         $employee->email = $request->email;
         $employee->save();
         return redirect('/property/employee');
     } else {
         return redirect()->back();
     }
 }
コード例 #11
0
 public function importDBFs($br)
 {
     //(Request $request){
     $logfile = base_path() . DIRECTORY_SEPARATOR . 'logs' . DIRECTORY_SEPARATOR . 'db-import.txt';
     //return Employee::with('childrens')->get();
     $import = true;
     if ($import) {
         $db = dbase_open('D:\\GI\\' . $br . '\\GC113015\\PAY_MAST.DBF', 0);
     } else {
         $db = dbase_open('D:\\GI\\MAR\\GC113015\\PAY_MAST.DBF', 0);
     }
     if ($db) {
         $header = dbase_get_header_info($db);
         if (!$import) {
             echo '<table cellpadding="2" cellspacing="0" border="1"><thead>';
         }
         // render table header
         if (!$import) {
             echo '<tr>';
             foreach ($header as $key => $value) {
                 echo '<th>' . $value['name'] . '</th>';
             }
             echo '</tr>';
         }
         // render table body
         $children_ctr = 0;
         $ecperson_ctr = 0;
         $education_ctr = 0;
         $work_ctr = 0;
         $spouse_ctr = 0;
         $record_numbers = dbase_numrecords($db);
         for ($i = 1; $i <= $record_numbers; $i++) {
             $row = dbase_get_record_with_names($db, $i);
             if ($i == 1) {
                 $brcode = trim($row['BRANCH']);
             }
             if ($import) {
                 $e = Employee::where('code', trim($row['MAN_NO']))->first();
                 if (!is_null($e)) {
                     continue;
                 }
             }
             $employee = new Employee();
             $employee->code = trim($row['MAN_NO']);
             $employee->lastname = trim($row['LAST_NAM']);
             $employee->firstname = trim($row['FIRS_NAM']);
             $employee->middlename = trim($row['MIDL_NAM']);
             $employee->companyid = trim($this->getCompanyId($row['CO_NAME']));
             $employee->id = $employee->get_uid();
             $branch = Branch::where('code', trim($row['BRANCH']))->first();
             $employee->branchid = is_null($branch) ? '' : $branch->id;
             $employee->deptid = $this->getDeptId($row['DEPT']);
             $employee->positionid = $this->getPositionId(trim($row['POSITION']));
             $employee->paytype = 2;
             $employee->ratetype = 2;
             $employee->rate = trim($row['RATE_HR']);
             $employee->ecola = trim($row['RATE_HR']);
             $employee->allowance1 = trim($row['ALW1_RATE']);
             $employee->allowance2 = trim($row['ALW2_RATE']);
             $employee->phicno = trim($row['PHEALTH_NO']);
             $employee->hdmfno = trim($row['PBIG_NO']);
             $employee->tin = trim($row['WTAX_NO']);
             $employee->sssno = trim($row['SSS_NO']);
             $employee->empstatus = $this->getEmpstatus(trim($row['EMP_STUS']));
             $employee->datestart = Carbon::parse(trim($row['STARTED']));
             //$employee->datehired		= trim($row['ALW2_RATE']);
             //$employee->datestop			= trim($row['ALW2_RATE']);
             $employee->punching = 1;
             $employee->processing = 1;
             $employee->address = trim($row['ADDRESS1']) . ', ' . trim($row['ADDRESS2']) . ', ' . trim($row['ADDRESS3']);
             $employee->phone = trim($row['TEL']);
             //$employee->fax 					= trim($row['TEL']);
             $employee->mobile = trim($row['CEL']);
             $employee->email = trim($row['EMAIL']);
             $employee->gender = trim($row['SEX']) == 'M' ? 1 : 2;
             $employee->civstatus = trim($row['CIV_STUS']) == 'SINGLE' ? 1 : 2;
             $employee->height = str_replace("'", '.', trim($row['HEIGHT']));
             $employee->weight = trim($row['WEIGHT']);
             $employee->birthdate = Carbon::parse(trim($row['BIRTHDATE']));
             $employee->birthplace = trim($row['BIRTHPLC']);
             $employee->religionid = trim($this->getReligionId($row['RELIGION']));
             $employee->hobby = trim($row['HOBBIES']);
             $employee->notes = 'UNIFORM:' . trim($row['UNIFORM']) . '; ' . 'SP_NOTES1:' . trim($row['SP_NOTES1']) . '; ' . 'SP_NOTES2:' . trim($row['SP_NOTES2']) . '; ';
             $childrens = [];
             if (!empty(trim($row['CHILDREN1'])) && trim($row['CHILDREN1']) != 'N/A') {
                 $c1 = new Children();
                 $c1->firstname = trim($row['CHILDREN1']);
                 $c1->lastname = $employee->lastname;
                 $c1->id = $c1->get_uid();
                 array_push($childrens, $c1);
                 $children_ctr++;
             }
             if (!empty(trim($row['CHILDREN2'])) && trim($row['CHILDREN2']) != 'N/A') {
                 $c2 = new Children();
                 $c2->firstname = trim($row['CHILDREN2']);
                 $c2->lastname = $employee->lastname;
                 $c2->id = $c2->get_uid();
                 array_push($childrens, $c2);
                 $children_ctr++;
             }
             if ($import) {
                 $employee->childrens()->saveMany($childrens);
             }
             if (!empty(trim($row['EMER_NAM'])) && trim($row['EMER_NAM']) != 'N/A') {
                 $emer = explode(' ', trim($row['EMER_NAM']));
                 $e = new Ecperson();
                 $e->firstname = empty($emer[0]) ? '' : $emer[0];
                 $e->lastname = empty($emer[1]) ? '' : $emer[1];
                 $e->mobile = trim($row['EMER_NO']);
                 $e->id = $e->get_uid();
                 $ecperson_ctr++;
                 if ($import) {
                     $employee->ecperson()->save($e);
                 }
             }
             if (!empty(trim($row['EDUCATION'])) && trim($row['EDUCATION']) != 'N/A') {
                 $edu = new Education();
                 $edu->school = trim($row['EDUCATION']);
                 $edu->id = $edu->get_uid();
                 if ($import) {
                     $employee->educations()->saveMany([$edu]);
                 }
                 $education_ctr++;
             }
             $works = [];
             if (!empty(trim($row['WORKHIST1'])) && trim($row['WORKHIST1']) != 'N/A') {
                 $w1 = new Workexp();
                 $w1->company = trim($row['WORKHIST1']);
                 $w1->id = $w1->get_uid();
                 array_push($works, $w1);
                 $work_ctr++;
             }
             if (!empty(trim($row['WORKHIST2'])) && trim($row['WORKHIST2']) != 'N/A') {
                 $w2 = new Workexp();
                 $w2->company = trim($row['WORKHIST2']);
                 $w2->id = $w2->get_uid();
                 array_push($works, $w2);
                 $work_ctr++;
             }
             if (!empty(trim($row['WORKHIST3'])) && trim($row['WORKHIST3']) != 'N/A') {
                 $w3 = new Workexp();
                 $w3->company = trim($row['WORKHIST3']);
                 $w3->id = $w3->get_uid();
                 array_push($works, $w3);
                 $work_ctr++;
             }
             if (!empty(trim($row['WORKHIST4'])) && trim($row['WORKHIST4']) != 'N/A') {
                 $w4 = new Workexp();
                 $w4->company = trim($row['WORKHIST2']);
                 $w4->id = $w4->get_uid();
                 array_push($works, $w4);
                 $work_ctr++;
             }
             if ($import) {
                 $employee->workexps()->saveMany($works);
             }
             if (!empty(trim($row['SPOUS_NAM'])) && trim($row['SPOUS_NAM']) != 'N/A' && trim($row['SPOUS_NAM']) != 'NA/A') {
                 $sp = preg_split("/\\s+(?=\\S*+\$)/", trim($row['SPOUS_NAM']));
                 $spou = new Spouse();
                 $spou->firstname = empty($sp[0]) ? '' : $sp[0];
                 $spou->lastname = empty($sp[1]) ? '' : $sp[1];
                 $spou->id = $spou->get_uid();
                 $spouse_ctr++;
                 if ($import) {
                     $employee->spouse()->save($spou);
                 }
             }
             if ($import) {
                 $employee->save();
             }
             if (!$import) {
                 echo '<tr>';
                 foreach ($header as $key => $value) {
                     //if($value['name']=='CO_NAME')
                     //echo '<td>'.$this->getCompanyId($row[$value['name']]).'</td>';
                     //else
                     echo '<td>' . $row[$value['name']] . '</td>';
                 }
                 echo '</tr>';
             }
         }
         if ($import) {
             echo $brcode . ' imported! </br>';
             $handle = fopen($logfile, 'a');
             $content = $brcode . "\n\temployee:\t\t" . $record_numbers . "\n";
             $content .= "\tspouse:\t\t\t" . $spouse_ctr . "\n";
             $content .= "\tchildren:\t\t" . $children_ctr . "\n";
             $content .= "\tecperson:\t\t" . $ecperson_ctr . "\n";
             $content .= "\tworkexp:\t\t" . $work_ctr . "\n";
             fwrite($handle, $content);
             fclose($handle);
         }
         dbase_close($db);
     }
 }
コード例 #12
0
ファイル: EmployeesController.php プロジェクト: saj696/pipe
 public function store(EmployeeRequest $request)
 {
     try {
         DB::transaction(function () use($request) {
             $employee = new Employee();
             $file = $request->file('photo');
             $destinationPath = base_path() . '/public/image/employee/';
             if ($request->hasFile('photo')) {
                 $name = time() . $file->getClientOriginalName();
                 $file->move($destinationPath, $name);
                 $employee->photo = $name;
             }
             $employee->name = $request->input('name');
             $employee->mobile = $request->input('mobile');
             $employee->email = $request->input('email');
             $employee->present_address = $request->input('present_address');
             $employee->permanent_address = $request->input('permanent_address');
             $employee->dob = $request->input('dob');
             $employee->designation_id = $request->input('designation_id');
             $employee->workspace_id = $request->input('workspace_id');
             $employee->employee_type = $request->input('employee_type');
             $employee->joining_date = $request->input('joining_date');
             $employee->created_by = Auth::user()->id;
             $employee->created_at = time();
             $employee->save();
             $insertedId = $employee->id;
             // Creation As User
             if ($request->as_user == 1) {
                 $user = new User();
                 $file = $request->file('photo');
                 $destinationPath = base_path() . '/public/image/user/';
                 if ($request->hasFile('photo')) {
                     $name = time() . $file->getClientOriginalName();
                     $file->move($destinationPath, $name);
                     $user->photo = $name;
                 }
                 $user->username = $request->input('username');
                 $user->email = $request->input('email');
                 $user->password = bcrypt($request->input('password'));
                 $user->name_en = $request->input('name');
                 $user->workspace_id = $request->input('workspace_id');
                 $user->user_group_id = $request->input('user_group_id');
                 $user->present_address = $request->input('present_address');
                 $user->permanent_address = $request->input('permanent_address');
                 $user->save();
             }
             // Personal Account Creation
             $personalAccount = new PersonalAccount();
             $personalAccount->person_type = Config::get('common.person_type_employee');
             $personalAccount->person_id = $insertedId;
             $personalAccount->balance = $request->input('balance');
             $personalAccount->due = $request->input('due');
             $personalAccount->created_by = Auth::user()->id;
             $personalAccount->created_at = time();
             $personalAccount->save();
             // Impacts on accounting tables
             if ($request->input('balance') > 0) {
                 $workspace_id = Auth::user()->workspace_id;
                 $accountPayableCode = 41000;
                 $accountPayableWorkspaceData = WorkspaceLedger::where(['workspace_id' => $workspace_id, 'account_code' => $accountPayableCode, 'balance_type' => Config::get('common.balance_type_intermediate')])->first();
                 $accountPayableWorkspaceData->balance += $request->input('balance');
                 $accountPayableWorkspaceData->update();
             }
             if ($request->input('due') > 0) {
                 $workspace_id = Auth::user()->workspace_id;
                 $accountReceivableCode = 12000;
                 $accountReceivableWorkspaceData = WorkspaceLedger::where(['workspace_id' => $workspace_id, 'account_code' => $accountReceivableCode, 'balance_type' => Config::get('common.balance_type_intermediate')])->first();
                 $accountReceivableWorkspaceData->balance += $request->input('due');
                 $accountReceivableWorkspaceData->update();
             }
         });
     } catch (\Exception $e) {
         Session()->flash('error_message', 'Employee Not Created!');
         return redirect('employees');
     }
     Session()->flash('flash_message', 'Employee Created Successfully!');
     return redirect('employees');
 }
コード例 #13
0
ファイル: EmployeeController.php プロジェクト: sindotnet/cona
 /**
  * Creates a new Employee model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  * @return mixed
  */
 public function actionCreate()
 {
     $model = new Employee();
     $model->suspended = '0';
     $companies = Company::find()->asArray()->all();
     if ($model->load(Yii::$app->request->post()) && $model->save()) {
         /** Upload Images okstmtcc **/
         //Upload Signature
         if ($model->uploadSignature() !== false) {
             $signature = UploadedFile::getInstance($model, 'signature');
             // store the source file name
             $model->signature = $signature->name;
             $ext = end(explode(".", $signature->name));
             // generate a unique file name
             $model->signature = Yii::$app->security->generateRandomString() . ".{$ext}";
             // the path to save file, you can set an uploadPath
             // in Yii::$app->params (as used in example below)
             $path = Yii::$app->params['signaturePath'] . $model->signature;
             if ($model->save()) {
                 $signature->saveAs($path);
             }
         }
         //Upload Profile Image
         if ($model->uploadProfile() !== false) {
             $profile_image = UploadedFile::getInstance($model, 'profile_image');
             // store the source file name
             $model->profile_image = $profile_image->name;
             $ext = end(explode(".", $profile_image->name));
             // generate a unique file name
             $model->profile_image = Yii::$app->security->generateRandomString() . ".{$ext}";
             // the path to save file, you can set an uploadPath
             // in Yii::$app->params (as used in example below)
             $path = Yii::$app->params['profilePath'] . $model->profile_image;
             if ($model->save()) {
                 $profile_image->saveAs($path);
             }
         }
         //Upload NRIC Front
         if ($model->uploadNRICfront() !== false) {
             $NRIC_front = UploadedFile::getInstance($model, 'NRIC_front');
             // store the source file name
             $model->NRIC_front = $NRIC_front->name;
             $ext = end(explode(".", $NRIC_front->name));
             // generate a unique file name
             $model->NRIC_front = Yii::$app->security->generateRandomString() . ".{$ext}";
             // the path to save file, you can set an uploadPath
             // in Yii::$app->params (as used in example below)
             $path = Yii::$app->params['nricPath'] . $model->NRIC_front;
             if ($model->save()) {
                 $NRIC_front->saveAs($path);
             }
         }
         //Upload NRIC Back
         if ($model->uploadNRICback() !== false) {
             $NRIC_back = UploadedFile::getInstance($model, 'NRIC_back');
             // store the source file name
             $model->NRIC_back = $NRIC_back->name;
             $ext = end(explode(".", $NRIC_back->name));
             // generate a unique file name
             $model->NRIC_back = Yii::$app->security->generateRandomString() . ".{$ext}";
             // the path to save file, you can set an uploadPath
             // in Yii::$app->params (as used in example below)
             $path = Yii::$app->params['nricPath'] . $model->NRIC_back;
             if ($model->save()) {
                 $NRIC_back->saveAs($path);
             }
         }
         /** Upload Images okstmtcc **/
         return $this->redirect(['update', 'id' => $model->employee_id]);
     } else {
         return $this->render('create', ['model' => $model, 'companies' => $companies]);
     }
 }