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


PHP Employee::save方法代码示例

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


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

示例1: doCreate

 public function doCreate(CreateEmployeeRequest $request)
 {
     $employee = new Employee();
     $employee->line_id = $request->line;
     $employee->name = $request->name;
     $employee->email = $request->email;
     $employee->password = Hash::make($request->password);
     $employee->level_id = $request->level;
     if ($request->level == 7) {
         $employee->manager_id = $request->area_manager;
     } else {
         if ($request->level == 3) {
             $employee->manager_id = $request->sales_manager;
         }
     }
     $employee->hiring_date = $request->hiring_date;
     $employee->leaving_date = empty($request->leaving_date) ? NULL : $request->leaving_date;
     $employee->active = $request->active;
     try {
         if ($employee->save()) {
             $imgExtension = $request->file('photo')->getClientOriginalExtension();
             $request->file('photo')->move(public_path('img/avatar'), $employee->id);
         }
         return redirect()->back()->withInput($request->except('password'))->with('message', 'Employee has been added successfully !');
     } catch (ParseException $ex) {
         echo 'Failed to create new employee , with error message: ' . $ex->getMessage();
     }
 }
开发者ID:m-gamal,项目名称:crm,代码行数:28,代码来源:EmployeeController.php

示例2: store

 /**
  * Store a newly created resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @return \Illuminate\Http\Response
  */
 public function store(Request $request)
 {
     //validation
     $this->validate($request, ['name' => 'required|max:255', 'email' => 'required|email', 'address' => 'required', 'telephone' => 'telephone|required|max:10', 'salary' => 'required|integer|min:1', 'birth' => 'required|date_format:Y-m-d', 'hire' => 'required|date_format:Y-m-d']);
     //get data from input
     $input = $request->all();
     $name = $input['name'];
     //get name
     $email = $input['email'];
     //get email
     $address = $input['address'];
     //get name
     $telephone = $input['telephone'];
     //get telephone
     $salary = $input['salary'];
     //get salary
     $birth = $input['birth'];
     //get date of birth
     $hire = $input['hire'];
     //get date of hire
     // insert data into database
     $employee = new Employee();
     $employee->name = $name;
     $employee->email = $email;
     $employee->address = $address;
     $employee->telephone = $telephone;
     $employee->salary = $salary;
     $employee->data_of_birth = $birth;
     $employee->data_of_hire = $hire;
     $employee->save();
     // after save data will redirect to index page
     return redirect('/');
 }
开发者ID:ahmedzidan,项目名称:lara5.1,代码行数:39,代码来源:employeeController.php

示例3: store

 /**
  * Store a newly created resource in storage.
  *
  * @param  Request  $request
  * @return Response
  */
 public function store(EmployeeRequest $request)
 {
     $employee = new Employee($request->all());
     $employee->save();
     flash()->success('Success!', 'Employee created successfully');
     return redirect('/employees');
 }
开发者ID:amolkattel,项目名称:Asset-Mgnt-Project,代码行数:13,代码来源:EmployeesController.php

示例4: run

 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     $user = new Employee();
     $user->name = 'Administrator';
     $user->email = 'test@email.ae';
     $user->password = bcrypt('marktimbol');
     $user->save();
 }
开发者ID:marktimbol,项目名称:eclipse-tourism,代码行数:13,代码来源:UserTableSeeder.php

示例5: store

 /**
  * Store a newly created resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @return \Illuminate\Http\Response
  */
 public function store(StoreEmployeeRequest $request)
 {
     $user = User::create(['name' => $request->get('name'), 'surname' => $request->get('surname'), 'email' => $request->get('email'), 'password' => $request->get('password')]);
     $employee = new Employee();
     $employee->cert_auth = $request->get('email');
     $employee->save();
     $employee->user()->save($user);
     return redirect('/')->with('message', 'Kreiranje prodajalca je bilo uspešno.');
 }
开发者ID:vidmahovic,项目名称:ep-store,代码行数:15,代码来源:EmployeeController.php

示例6: store

 /**
  * Store a newly created resource in storage.
  *
  * @param  Request  $request
  * @return Response
  */
 public function store(Request $request)
 {
     $employee = new Employee();
     $employee->name = $request->input('name');
     $employee->email = $request->input('email');
     $employee->contact_number = $request->input('contact_number');
     $employee->position = $request->input('position');
     $employee->save();
     return 'Employee record successfully created with id ' . $employee->id;
 }
开发者ID:buddhashilpa,项目名称:learningapp,代码行数:16,代码来源:Employees.php

示例7: store

 /**
  * Store a newly created resource in storage.
  *
  * @param  Request  $request
  * @return Response
  */
 public function store(Request $request)
 {
     $this->validate($request, ['first_name' => 'required|max:100', 'middle_name' => 'required|max:100', 'last_name' => 'required|max:100', 'emp_id' => 'required|max:100', 'card_no' => 'required|max:100']);
     $employee = new Employee();
     $employee->first_name = $request->first_name;
     $employee->middle_name = $request->middle_name;
     $employee->last_name = $request->last_name;
     $employee->emp_id = $request->emp_id;
     $employee->card_no = $request->card_no;
     $employee->active = 1;
     $employee->save();
     Session::flash('flash_message', 'Terminal successfully added!');
     return redirect()->route("employee.index");
 }
开发者ID:renciebautista,项目名称:em,代码行数:20,代码来源:EmployeesController.php

示例8: store

 /**
  * Store a newly created resource in storage.
  *
  * @return Response
  */
 public function store()
 {
     $input = Input::all();
     $employee = new Employee();
     $rules = array('firstname' => 'required', 'lastname' => 'required', 'designation' => 'required');
     $validator = Validator::make($input, $rules);
     if ($validator->passes()) {
         $employee->firstname = $input['firstname'];
         $employee->lastname = $input['lastname'];
         $employee->contact = $input['contact'];
         $employee->address = $input['address'];
         $employee->designation_id = $input['designation'];
         $employee->save();
         return Redirect::action('EmployeeController@index');
     }
     return Redirect::action('EmployeeController@create');
 }
开发者ID:MangTomas23,项目名称:tgm,代码行数:22,代码来源:EmployeeController.php

示例9: run

 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     factory(App\Employee::class, 20)->create()->each(function ($employee) {
         $employee->user()->save(factory(User::class, 'employee')->create());
     });
     $user = new User();
     $user->name = 'Erik';
     $user->surname = 'Drobne';
     $user->email = 'erik.drobne@gmail.com';
     $user->password = 'erik123';
     $user->verified = true;
     $user->save();
     $employee = new Employee();
     $employee->cert_auth = 'erik.drobne@gmail.com';
     $employee->save();
     $employee->user()->save($user);
 }
开发者ID:vidmahovic,项目名称:ep-store,代码行数:22,代码来源:EmployeesTableSeeder.php

示例10: create

 /**
  * Show the form for creating a new resource.
  *
  * @return Response
  */
 public function create()
 {
     $employee = new Employee();
     $employee->first_name = Input::get('first_name');
     $employee->last_name = Input::get('last_name');
     $employee->name = Input::get('first_name') . ' ' . Input::get('last_name');
     $employee->email = Input::get('email');
     $employee->position = Input::get('position');
     $employee->phone = Input::get('phone');
     $employee->location_id = Input::get('location');
     $employee->status = 1;
     $employee->role_id = 5;
     $employee->department = Input::get('department');
     $employee->extension_no = Input::get('extension_no');
     $employee->vehicle_no = Input::get('vehicle_no');
     $employee->save();
     return Response::json(array('success' => 'Employee has been added!'));
 }
开发者ID:subhadip-sahoo,项目名称:laravel,代码行数:23,代码来源:EmployeeController.php

示例11: postAddemployee

 public function postAddemployee(Request $request)
 {
     $rules = array('empname' => 'required', 'empid' => 'required', 'emppos' => 'required', 'empdept' => 'required');
     $validator = Validator::make(Input::all(), $rules);
     if ($validator->fails()) {
         return redirect('approval/home')->withErrors($validator);
     } else {
         $data = Input::get();
         $c = new Employee();
         $c->emp_name = $data['empname'];
         $c->emp_ide_id = $data['empid'];
         $c->emp_position = $data['emppos'];
         $c->emp_department = $data['empdept'];
         $c->save();
     }
     $request->session()->flash('alert-success', 'Target Has Been Assigned Successfully');
     return redirect('approval/home');
     //
 }
开发者ID:harshithanaiduk,项目名称:iclock-newtheme,代码行数:19,代码来源:ApprovalController.php

示例12: postRegister

 protected function postRegister(RegisterRequest $request)
 {
     //$this->user->name = $request->name;
     $this->user->email = $request->email;
     $this->user->password = bcrypt($request->password);
     $this->user->is_admin = 0;
     $this->user->role = 'E';
     $this->user->save();
     //return redirect('laravel_angular/users/login');
     if ($this->auth->attempt($request->only('email', 'password'))) {
         $user = $this->auth->user();
         $employee = new Employee();
         $employee->name = $request->name;
         $employee->email = $request->email;
         //$employee->contact_number = $request->contact_number;
         //$employee->position = $request->position;
         $employee->user_id = $user->id;
         $employee->save();
         return redirect()->route('dashboard')->with('name', $request->name);
     }
 }
开发者ID:subhankarbachchu,项目名称:laravel_angular,代码行数:21,代码来源:AuthController.php

示例13: handleCreateEmployee

 public function handleCreateEmployee()
 {
     // create the validation rules ------------------------
     $rules = array('first_name' => 'required', 'last_name' => 'required', 'email' => 'required|email|unique:users', 'location' => 'required');
     // do the validation ----------------------------------
     // validate against the inputs from our form
     $validator = Validator::make(Input::all(), $rules);
     // check if the validator failed -----------------------
     if ($validator->fails()) {
         // get the error messages from the validator
         $messages = $validator->messages();
         // redirect our user back to the form with the errors from the validator
         return Redirect::action('CommonController@createEmployee')->withErrors($validator)->withInput();
     } else {
         $employee = new Employee();
         $employee->first_name = Input::get('first_name');
         $employee->last_name = Input::get('last_name');
         $employee->name = Input::get('first_name') . ' ' . Input::get('last_name');
         $employee->email = Input::get('email');
         $employee->position = Input::get('position');
         $employee->phone = Input::get('phone');
         $employee->location_id = Input::get('location');
         $employee->status = 1;
         $employee->role_id = 5;
         $employee->save();
         return Redirect::action('CommonController@employees');
     }
 }
开发者ID:subhadip-sahoo,项目名称:laravel,代码行数:28,代码来源:CommonController.php

示例14: store

 /**
  * Receive request post save employee
  * @param  Request
  * @return [type]
  */
 public function store(Request $request)
 {
     $employee = new Employee();
     $v = Validator::make($request->all(), ["firstname" => "required|min:2", "lastname" => "required|min:2", "phone" => "required|min:10|max:11", "dateofbirth" => "required", 'employee_code' => 'required|min:7|unique:employees', 'email' => 'required|unique:employees']);
     if ($v->fails()) {
         return redirect()->back()->withErrors($v->errors());
     }
     $date = $request->get('dateofbirth');
     $dates = $this->convert_datepicker_to_datetimesql($date);
     $employee->employee_code = $request->get('employee_code');
     $employee->firstname = $request->get('firstname');
     $employee->lastname = $request->get('lastname');
     $employee->date_of_birth = $dates;
     $employee->email = $request->get('email');
     $employee->gender = $request->get('gender');
     $employee->phone = $request->get('phone');
     $employee->position_id = $request->get('position_id');
     $employee->nationality = $request->get('nationality');
     $employee->save();
     return redirect()->route('employee.index')->with('messageOk', 'Add employee successfully!');
 }
开发者ID:phanngoc,项目名称:internal-tool,代码行数:26,代码来源:EmployeeController.php

示例15: store

 public function store(Request $request)
 {
     $validation = Validator::make($request->all(), ['name' => 'required|min:4|max:55', 'no_ktp' => 'required|min:15|max:20|unique:employees', 'tempat_lahir' => 'required|min:4|max:55', 'tanggal_lahir' => 'required', 'kelamin' => 'required', 'agama' => 'required', 'status_nikah' => 'required', 'nohp' => 'required', 'alamat' => 'required|min:10|max:555', 'pt' => 'required', 'id_provinces' => 'required']);
     $author = Auth::user()->id;
     // Check if it fails //
     if ($validation->fails()) {
         return redirect()->back()->withInput()->with('errors', $validation->errors());
     }
     // tag cities
     $fr = serialize(Input::get('cities'));
     $filename = " ";
     $jabatan = $request->input('jabatan');
     if ($jabatan > 0) {
         $internal = 1;
     } else {
         $internal = 0;
     }
     if (!empty($request->file('userfile'))) {
         // upload the employee //
         $image = $request->file('userfile');
         $filename = time() . '.' . $image->getClientOriginalExtension();
         $path = public_path('assets/employee/' . $filename);
         $img = Image::make($image->getRealPath());
         // resize the image to a width of 300 and constrain aspect ratio (auto height)
         $img->resize(300, null, function ($constraint) {
             $constraint->aspectRatio();
         });
         $img->save($path);
     }
     $data = new Employee();
     // save category data into database //
     $data->name = $request->input('name');
     $data->tempat_lahir = $request->input('tempat_lahir');
     $data->tanggal_lahir = $request->input('tanggal_lahir');
     $data->kelamin = $request->input('kelamin');
     $data->agama = $request->input('agama');
     $data->status_nikah = $request->input('status_nikah');
     $data->no_ktp = $request->input('no_ktp');
     $data->berat_badan = $request->input('berat_badan');
     $data->tinggi_badan = $request->input('tinggi_badan');
     $data->nohp = $request->input('nohp');
     $data->nohp2 = $request->input('nohp2');
     $data->alamat = $request->input('alamat');
     $data->pendidikan = $request->input('pt');
     $data->des_pendidikan = $request->input('ptd');
     $data->id_provinces = $request->input('id_provinces');
     $data->id_cities = $fr;
     $data->id_user = $author;
     $data->id_jabatans = $jabatan;
     $data->internal = $internal;
     $data->notes = $request->input('notes');
     $data->grade = $request->input('grade');
     $data->pict = $filename;
     $data->save();
     Alert::success('Sukses input ' . $request->input('name') . ' !')->persistent("Close");
     return redirect('data/list')->with('message', 'You just create ' . $request->input('name') . ' !');
 }
开发者ID:arisros,项目名称:drope.mployee,代码行数:57,代码来源:DataController.php


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