当前位置: 首页>>代码示例>>PHP>>正文


PHP Employee::findOrFail方法代码示例

本文整理汇总了PHP中Employee::findOrFail方法的典型用法代码示例。如果您正苦于以下问题:PHP Employee::findOrFail方法的具体用法?PHP Employee::findOrFail怎么用?PHP Employee::findOrFail使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Employee的用法示例。


在下文中一共展示了Employee::findOrFail方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: update

 public function update($id)
 {
     $employee = Employee::findOrFail($id);
     $validator = Validator::make($data = Input::all(), Employee::$rules);
     if ($validator->fails()) {
         return Redirect::back()->withErrors($validator)->withInput();
     }
     $employee->update($data);
     return Redirect::route('employees.index');
 }
开发者ID:noikiy,项目名称:posco-laravel-server,代码行数:10,代码来源:EmployeesController.php

示例2: update

 /**
  * Update the specified product in storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function update($id)
 {
     $employee = Employee::findOrFail($id);
     $validator = Validator::make(Input::all(), Employee::$rules);
     if ($validator->passes()) {
         $employee->update(Input::all());
         return Response::json(array('success' => true, 'message' => array('type' => 'success', 'msg' => 'Cập nhật nhân viên thành công!')));
     } else {
         return Response::json(array('success' => false, 'errors' => $validator->errors()));
     }
 }
开发者ID:jimmyhien,项目名称:dailyhuuhoc,代码行数:17,代码来源:EmployeesController.php

示例3: update

 public function update($id)
 {
     $employee = Employee::findOrFail($id);
     $employee->employee_id = Input::get('employee_id');
     $employee->code = Input::get('code');
     $employee->name = Input::get('name');
     $employee->contact = Input::get('contact');
     $employee->basic_salary = Input::get('basic_salary');
     $employee->teach_salary = Input::get('teach_salary');
     $employee->save();
     Session::flash('message', 'Sukses mengupdate data pegawai!');
 }
开发者ID:emanmks,项目名称:oneschool,代码行数:12,代码来源:EmployeesController.php

示例4: destroy

 /**
  * Remove the specified branch from storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function destroy($id)
 {
     $employee = Employee::findOrFail($id);
     Employee::destroy($id);
     Audit::logaudit('Employee', 'delete', 'deleted: ' . $employee->personal_file_number . '-' . $employee->first_name . ' ' . $employee->last_name);
     return Redirect::route('employees.index');
 }
开发者ID:kenkode,项目名称:xaraerp,代码行数:13,代码来源:EmployeesController.php

示例5: getEmployeeName

 public static function getEmployeeName($id)
 {
     $employee = Employee::findOrFail($id);
     $name = $employee->personal_file_number . '-' . $employee->first_name . ' ' . $employee->last_name;
     return $name;
 }
开发者ID:kenkode,项目名称:umash,代码行数:6,代码来源:Employee.php

示例6: update

 /**
  * Update the specified employee in storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function update($id)
 {
     $employee = Employee::findOrFail($id);
     /*if (Input::get('email') !== $employee->email) {
                 $input = array('email' => Input::get('email'));
                 $validator = Validator::make($input, array('email' => 'unique:employees'));
     
                 if ($validator->fails())
                 {
                     return Redirect::back()->withErrors($validator)->withInput();
                 }
     
             }*/
     $data = Input::all();
     /*$validator = Validator::make($data, array('status' => 'required', 'role' => 'required'));
     
             if ($validator->fails())
             {
                 return Redirect::back()->withErrors($validator)->withInput();
             }*/
     $employee->update($data);
     return Redirect::route('employees.index');
 }
开发者ID:saqibtalib,项目名称:EMR-ex-,代码行数:29,代码来源:EmployeesController.php

示例7: update

 /**
  * Update the specified resource in storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function update($id)
 {
     if (\Request::ajax()) {
         // print_r(\Input::all());
         $personalval = \Input::get('personalval');
         $contactval = \Input::get('contactval');
         $identval = \Input::get('identval');
         $pfval = \Input::get('pfval');
         $jobval = \Input::get('jobval');
         $salval = \Input::get('salval');
         $eduval = \Input::get('eduval');
         $workExpFrom = \Input::get('workExpFrom');
         if (isset($personalval)) {
             $id = $personalval;
             $firstname = \Input::get('firstname');
             $lastname = \Input::get('lastname');
             $middlename = \Input::get('middlename');
             $fathername = \Input::get('fathername');
             $mothermaiden = \Input::get('mothermaiden');
             $dateofbirth = Implode('-', array_reverse(explode('/', \Input::get('dateofbirth'))));
             $spousename = \Input::get('spousename');
             $maritialstatus = \Input::get('maritialstatus');
             if ($maritialstatus != 'married') {
                 $spousename = '';
             }
             $bloodgroup = \Input::get('bloodgroup');
             $sibling = \Input::get('sibling');
             // Call Model
             $personal = \Employee::findOrFail($id);
             $personal->firstname = $firstname;
             $personal->lastname = $lastname;
             $personal->middlename = $middlename;
             $personal->fathername = $fathername;
             $personal->mothermaiden = $mothermaiden;
             $personal->dateofbirth = $dateofbirth;
             $personal->maritialstatus = $maritialstatus;
             $personal->spousename = $spousename;
             $personal->sibling = $sibling;
             $personal->bloodgroup = $bloodgroup;
             if ($personal->save()) {
                 \Session::flash('success', "Successfully updated");
                 return;
             } else {
                 echo "Failed to Update";
                 return;
             }
         }
         // Contact Values
         if (isset($contactval)) {
             $id = $contactval;
             $address = \Input::get('address');
             $city = \Input::get('city');
             $state = \Input::get('state');
             $pin = \Input::get('pin');
             $p_address = \Input::get('p_address');
             $p_city = \Input::get('p_city');
             $p_state = \Input::get('p_state');
             $p_pin = \Input::get('p_pin');
             $mobile = \Input::get('mobile');
             $phone = \Input::get('phone');
             $alt_mobile = \Input::get('alt_mobile');
             $alt_email = \Input::get('alt_email');
             $contact = \UserContact::findOrFail($id);
             $contact->address = $address;
             $contact->city = $city;
             $contact->state = $state;
             $contact->pin = $pin;
             $contact->p_address = $p_address;
             $contact->p_city = $p_city;
             $contact->p_state = $p_state;
             $contact->mobile = $mobile;
             $contact->phone = $phone;
             $contact->alt_mobile = $alt_mobile;
             $contact->alt_email = $alt_email;
             if ($contact->save()) {
                 \Session::flash('success', "Successfully contact updated");
                 return;
             } else {
                 echo "Failed to Update";
                 return;
             }
         }
         // Idetification table
         if ($identval) {
             $id = $identval;
             $bankId = \Input::get('bankId');
             $pan = \Input::get('pan');
             $passportno = \Input::get('passportno');
             $adharno = \Input::get('adharno');
             $voterid = \Input::get('voterid');
             $dlno = \Input::get('dlno');
             $bankaccountno = \Input::get('bankaccountno');
             $bankname = \Input::get('bankname');
             $branchname = \Input::get('branchname');
//.........这里部分代码省略.........
开发者ID:bhoopal10,项目名称:PayrollOriginal,代码行数:101,代码来源:EmployeeController.php


注:本文中的Employee::findOrFail方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。