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


PHP Employee::create方法代码示例

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


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

示例1: run

 public function run()
 {
     $faker = Faker::create();
     foreach (range(1, 10) as $index) {
         Employee::create([]);
     }
 }
开发者ID:jarciga,项目名称:Euler2015Alpha,代码行数:7,代码来源:EmployeesTableSeeder.php

示例2: postCreate

 /**
  * This function create employee
  * when data is posted from 
  * /admin/employee/create
  */
 public function postCreate()
 {
     // Check validation
     $validator = Validator::make(Input::all(), Employee::$rulesForCreate, Employee::$messages);
     // If failed then redirect to employee-create-get route with
     // validation error and input old
     if ($validator->fails()) {
         return Redirect::route('employee-create-get')->withErrors($validator)->withInput();
     }
     // If validation is not failed then create employee
     $employee = Employee::create(array('first_name' => Input::get('first_name'), 'last_name' => Input::get('last_name'), 'age' => Input::get('age'), 'gender' => Input::get('gender'), 'DOB' => DateFormat::store(Input::get('DOB')), 'present_address' => Input::get('present_address'), 'permanent_address' => Input::get('permanent_address'), 'city' => Input::get('city'), 'state' => Input::get('state'), 'country' => Input::get('country'), 'mobile_no' => Input::get('mobile_no'), 'email' => Input::get('email'), 'created_by' => Session::get('username')));
     // Also create user account for the employee
     $user = User::create(array('details_id' => $employee->id, 'username' => Input::get('username'), 'email' => $employee->email, 'user_level' => Input::get('userlevel'), 'active' => 0));
     // generate random code and password
     $password = str_random(10);
     $code = str_random(60);
     $newHashPassword = Hash::make($password);
     // Save new password and code
     $user->password_tmp = $newHashPassword;
     $user->activation_code = $code;
     if ($user->save()) {
         // Send email to the employee.
         // This email contains username,password,activation link
         Mail::send('emails.auth.activation', array('first_name' => $employee->first_name, 'last_name' => $employee->last_name, 'username' => $user->username, 'password' => $password, 'activation_link' => URL::route('activation-get', $code)), function ($message) use($user) {
             $message->to($user->email, $user->username)->subject('Confirm Activation');
         });
     }
     return View::make('adminArea.employee.create')->with('success', 'Activation link has been sent successfully');
 }
开发者ID:madiarsa,项目名称:DVD-Rental,代码行数:34,代码来源:EmployeeController.php

示例3: store

 public function store()
 {
     $validator = Validator::make($data = Input::all(), Employee::$rules);
     if ($validator->fails()) {
         return Redirect::back()->withErrors($validator)->withInput();
     }
     /* Employee */
     if (Input::has('createEmployee')) {
         Employee::create($data);
     }
     $message = "登録しました。";
     if (Input::has('deleteEmployee')) {
         $e = Employee::where('name', Input::get('name'))->first();
         Employee::destroy($e->id);
         $message = "削除しました。";
         if (Input::has('selectedEmployee')) {
             Input::replace(array('selectedEmployee', ''));
         }
     }
     if (Input::has('updateEmployee')) {
         $validator_for_update = Validator::make($data = Input::all(), Employee::$update_rules);
         if ($validator_for_update->fails()) {
             return Redirect::back()->withErrors($validator_for_update)->withInput();
         }
         $e = Employee::where('name', Input::get('name'))->first();
         Employee::destroy($e->id);
         $data['name'] = $data['new_name'];
         Employee::create($data);
         $message = "更新しました。";
     }
     return Redirect::route('employees.index')->with('message', $message);
 }
开发者ID:noikiy,项目名称:posco-laravel-server,代码行数:32,代码来源:EmployeesController.php

示例4: run

 public function run()
 {
     DB::table('employees')->truncate();
     Employee::create(['firstname' => 'Guido', 'lastname' => 'Bergman', 'email' => 'guido@matas.nl', 'password' => Hash::make('secret'), 'admin' => 'true']);
     Employee::create(['firstname' => 'Rob', 'lastname' => 'Gloudemans', 'email' => 'rob@matas.nl', 'password' => Hash::make('secret'), 'admin' => 'false']);
     Employee::create(['firstname' => 'Peter', 'lastname' => 'Klaassen', 'email' => 'peter@matas.nl', 'password' => Hash::make('secret'), 'admin' => 'false']);
     Employee::create(['firstname' => 'Dave', 'lastname' => 'van der Donk', 'email' => 'dave@matas.nl', 'password' => Hash::make('secret'), 'admin' => 'false']);
 }
开发者ID:gerry411,项目名称:MatasTasklist,代码行数:8,代码来源:EmployeesTableSeeder.php

示例5: can_remove_scope

 /** @test */
 public function can_remove_scope()
 {
     User::create();
     Employee::create();
     $users = Employee::withoutGlobalScope(SingleTableInheritanceScope::class)->orderBy('type', 'DESC')->get();
     $this->assertCount(2, $users);
     $this->assertInstanceOf(Employee::class, $users[0]);
     $this->assertInstanceOf(User::class, $users[1]);
 }
开发者ID:tonysm,项目名称:eloquent-sti,代码行数:10,代码来源:SingleTableInheritanceIntegrationTest.php

示例6: store

 /**
  * Store a newly created employee in storage.
  *
  * @return Response
  */
 public function store()
 {
     $validator = Validator::make($data = Input::all(), Employee::$rules);
     if ($validator->fails()) {
         return Redirect::back()->withErrors($validator)->withInput();
     }
     Employee::create($data);
     return Redirect::route('employees.index');
 }
开发者ID:ThomasNYoung,项目名称:phantom-reporter,代码行数:14,代码来源:EmployeesController.php

示例7: store

 /**
  * Store a newly created product in storage.
  *
  * @return Response
  */
 public function store()
 {
     $validator = Validator::make(Input::all(), Employee::$rules);
     if ($validator->passes()) {
         Employee::create(Input::all());
         return Response::json(array('success' => true, 'message' => array('type' => 'success', 'msg' => 'Thêm nhân viên thành công!')));
     } else {
         return Response::json(array('success' => false, 'errors' => $validator->errors()));
     }
 }
开发者ID:jimmyhien,项目名称:dailyhuuhoc,代码行数:15,代码来源:EmployeesController.php

示例8: addEmployee

 public function addEmployee()
 {
     $emp = Employee::get();
     $isAdded = FALSE;
     $validInput = TRUE;
     $regex = "/^[a-zA-Z\\'\\-\\.]+( [a-zA-Z\\'\\-\\.]+)*\$/";
     $regexHouse = "/[0-9a-zA-Z\\-\\s]+\$/";
     $regexStreet = "/^[a-zA-Z0-9\\'\\-\\.]+( [a-zA-Z0-9\\'\\-\\.]+)*\$/";
     $regexBarangay = "/^[a-zA-Z0-9\\'\\-\\.]+( [a-zA-Z0-9\\'\\-\\.]+)*\$/";
     $regexCity = "/^[a-zA-Z\\'\\-]+( [a-zA-Z\\'\\-]+)*\$/";
     $regexZip = "/^[0-9]+\$/";
     $regexProvince = "/^[a-zA-Z\\'\\-]+( [a-zA-Z\\'\\-]+)*\$/";
     if (!trim(Input::get('addFirstName')) == '' && !trim(Input::get('addLastName')) == '' && !trim(Input::get('addEmpHouseNo')) == '' && !trim(Input::get('addEmail')) == '' && !trim(Input::get('addEmpStreet')) == '' && !trim(Input::get('addEmpCity')) == '' && !trim(Input::get('addCellNo')) == '') {
         $validInput = TRUE;
         if (preg_match($regex, Input::get('addFirstName')) && preg_match($regex, Input::get('addLastName')) && preg_match($regexStreet, Input::get('addEmpStreet')) && !!filter_var(Input::get('addEmail'), FILTER_VALIDATE_EMAIL) && preg_match($regexHouse, Input::get('addEmpHouseNo')) && preg_match($regexCity, Input::get('addEmpCity'))) {
             $validInput = TRUE;
             if (!trim(Input::get('addEmpZipCode')) == '' || !trim(Input::get('addEmpProvince')) == '' || !trim(Input::get('addEmpBarangay')) == 0) {
                 if (preg_match($regexZip, Input::get('addEmpZipCode')) || preg_match($regexProvince, Input::get('addEmpProvince')) || preg_match($regexBarangay, Input::get('addEmpBarangay'))) {
                     $validInput = TRUE;
                 } else {
                     $validInput = FALSE;
                 }
             }
         } else {
             $validInput = FALSE;
         }
     } else {
         $validInput = FALSE;
     }
     //dd($validInput);
     $count = DB::table('tblEmployee')->select('tblEmployee.strEmailAdd')->where('tblEmployee.strEmailAdd', '=', trim(Input::get('addEmail')))->count();
     $count2 = DB::table('tblEmployee')->select('tblEmployee.strCellNo')->where('tblEmployee.strCellNo', '=', trim(Input::get('addCellNo')))->count();
     if ($count > 0 || $count2 > 0) {
         $isAdded = TRUE;
     } else {
         foreach ($emp as $emp) {
             if (strcasecmp($emp->strEmpFName, trim(Input::get('addFirstName'))) == 0 && strcasecmp($emp->strEmpMName, trim(Input::get('addMiddleName'))) == 0 && strcasecmp($emp->strEmpLName, trim(Input::get('addLastName'))) == 0) {
                 //$isAdded = TRUE;
                 dd(strcasecmp($emp->strEmpFName, trim(Input::get('addFirstName'))), strcasecmp($emp->strEmpMName, trim(Input::get('addMiddleName'))), strcasecmp($emp->strEmpLName, trim(Input::get('addLastName'))));
             }
         }
     }
     if ($validInput) {
         if (!$isAdded) {
             $employee = Employee::create(array('strEmployeeID' => Input::get('addEmpID'), 'strEmpFName' => trim(Input::get('addFirstName')), 'strEmpMName' => trim(Input::get('addMiddleName')), 'strEmpLName' => trim(Input::get('addLastName')), 'dtEmpBday' => date("Y-m-d", strtotime(Input::get("adddtEmpBday"))), 'strSex' => Input::get('addSex'), 'strEmpHouseNo' => trim(Input::get('addEmpHouseNo')), 'strEmpStreet' => trim(Input::get('addEmpStreet')), 'strEmpBarangay' => trim(Input::get('addEmpBarangay')), 'strEmpCity' => trim(Input::get('addEmpCity')), 'strEmpProvince' => trim(Input::get('addEmpProvince')), 'strEmpZipCode' => trim(Input::get('addEmpZipCode')), 'strRole' => Input::get('addRoles'), 'strCellNo' => trim(Input::get('addCellNo')), 'strCellNoAlt' => trim(Input::get('addCellNoAlt')), 'strPhoneNo' => trim(Input::get('addPhoneNo')), 'strEmailAdd' => trim(Input::get('addEmail')), 'boolIsActive' => 1));
             $employee->save();
             return Redirect::to('/maintenance/employee?success=true');
         } else {
             return Redirect::to('/maintenance/employee?success=duplicate');
         }
     } else {
         return Redirect::to('/maintenance/employee?input=invalid');
     }
 }
开发者ID:MorrielAlexis,项目名称:SADTAILORING,代码行数:54,代码来源:EmployeeController.php

示例9: store

 /**
  * Store a newly created user in the database.
  *
  * @return to the home page
  */
 public function store()
 {
     //Create an employee
     if (!User::registerIsValid(Input::all())) {
         return Redirect::back()->withInput()->withErrors(User::$errors);
     }
     $addEmployee = Employee::create(Input::all());
     $addEmployee->password = Hash::make(Input::get('password'));
     $addEmployee->save();
     return Redirect::route('pages.index');
 }
开发者ID:gerry411,项目名称:MatasTasklist,代码行数:16,代码来源:RegisterController.php

示例10: store

 /**
  * Store a newly created employee in storage.
  *
  * @return Response
  */
 public function store()
 {
     $validator = Validator::make($data = Input::all(), Employee::$rules);
     if ($validator->fails()) {
         return Redirect::back()->withErrors($validator)->withInput();
     }
     $data['no'] = '';
     $data['short_name'] = '';
     $data['right'] = '';
     $data['actived'] = 1;
     Employee::create($data);
     return Redirect::route('admin.employees.index');
 }
开发者ID:yanguanglan,项目名称:sz,代码行数:18,代码来源:EmployeesController.php

示例11: doAddEmployee

 /**
  * Add new employee to the DB
  *
  * @return mixed
  */
 public function doAddEmployee()
 {
     $employee = ['firstname' => Input::get('firstname'), 'lastname' => Input::get('lastname'), 'extension' => Input::get('extension'), 'primary_email' => Input::get('primary_email'), 'role' => Input::get('role'), 'location_id' => Input::get('location'), 'dept_id' => Input::get('dept')];
     $rules = ['firstname' => 'required', 'lastname' => 'required', 'extension' => 'numeric', 'primary_email' => 'email', 'role' => 'required', 'location_id' => 'required', 'dept_id' => 'required'];
     $messages = ['firstname.required' => 'Please enter a first name', 'lastname.required' => 'Please enter a last name', 'extension.numeric' => 'The extension can only contain numbers', 'primary_email.email' => 'Please enter a valid email', 'role.required' => 'Please enter a role', 'location_id.required' => 'You must choose a location', 'dept_id.required' => 'You must choose a department'];
     $validator = Validator::make($employee, $rules, $messages);
     if ($validator->passes()) {
         Employee::create($employee);
         return Redirect::back();
     } else {
         return Redirect::back()->withErrors($validator)->withInput();
     }
 }
开发者ID:heidilux,项目名称:Company-Directory-L4,代码行数:18,代码来源:AdminController.php

示例12: createEmployee

 public function createEmployee()
 {
     $employee = Employee::create(array('first_name' => 'Iftekher', 'last_name' => 'Sunny', 'age' => 23, 'gender' => 'Male', 'DOB' => Carbon::today(), 'present_address' => 'Present address .....', 'permanent_address' => 'Permanent address ...', 'city' => 'Chittagong', 'state' => 'state ....', 'country' => 'Bangladesh', 'mobile_no' => '+8801800000000', 'email' => 'employee@gmail.com', 'created_by' => 'Developer'));
     $user = User::create(array('username' => 'employee', 'password' => Hash::make('employee'), 'user_level' => 'employee123', 'email' => 'employee@gmail.com', 'password_tmp' => '', 'activation_code' => '', 'active' => 1, 'remember_token' => '', 'details_id' => $employee->id));
     // generate random code and password
     $password = str_random(10);
     $code = str_random(60);
     $newHashPassword = Hash::make($password);
     // Save new password and code
     $user->password_tmp = $newHashPassword;
     $user->activation_code = $code;
     $user->save();
 }
开发者ID:madiarsa,项目名称:DVD-Rental,代码行数:13,代码来源:UserTableSeeder.php

示例13: run

 public function run()
 {
     DB::table('employees')->where('email', 'super@gmail.com')->delete();
     Employee::create(['name' => 'Fahad Ali', 'password' => Hash::make('123456'), 'email' => 'super@gmail.com', 'gender' => 'Male', 'age' => '23', 'city' => 'Lahore', 'country' => 'Pakistan', 'address' => '10 Down Street', 'phone' => '03344050495', 'cnic' => '1234679', 'role' => 'Super User', 'status' => 'Active', 'branch' => 'DHA', 'note' => 'MBBS Qualified']);
     DB::table('employees')->where('email', 'admin@gmail.com')->delete();
     Employee::create(['name' => 'Shah', 'password' => Hash::make('123456'), 'email' => 'admin@gmail.com', 'gender' => 'Male', 'age' => '23', 'city' => 'Lahore', 'country' => 'Pakistan', 'address' => '10 Down Street', 'phone' => '03344050495', 'cnic' => '1234679', 'role' => 'Administrator', 'status' => 'Active', 'branch' => 'DHA', 'note' => 'MBBS Qualified', 'clinic_id' => 1]);
     DB::table('employees')->where('email', 'doctor@gmail.com')->delete();
     Employee::create(['name' => 'Ali', 'password' => Hash::make('123456'), 'email' => 'doctor@gmail.com', 'gender' => 'Male', 'age' => '23', 'city' => 'Lahore', 'country' => 'Pakistan', 'address' => '10 Down Street', 'phone' => '03344050495', 'cnic' => '1234679', 'role' => 'Doctor', 'status' => 'Active', 'branch' => 'DHA', 'note' => 'MBBS Qualified', 'clinic_id' => 1]);
     DB::table('employees')->where('email', 'accountant@gmail.com')->delete();
     Employee::create(['name' => 'Umer', 'password' => Hash::make('123456'), 'email' => 'accountant@gmail.com', 'gender' => 'Male', 'age' => '23', 'city' => 'Lahore', 'country' => 'Pakistan', 'address' => '10 Down Street', 'phone' => '03344050495', 'cnic' => '1234679', 'role' => 'Accountant', 'status' => 'Active', 'branch' => 'DHA', 'note' => 'MBBS Qualified', 'clinic_id' => 1]);
     DB::table('employees')->where('email', 'receptionist@gmail.com')->delete();
     Employee::create(['name' => 'Talal', 'password' => Hash::make('123456'), 'email' => 'receptionist@gmail.com', 'gender' => 'Male', 'age' => '23', 'city' => 'Lahore', 'country' => 'Pakistan', 'address' => '10 Down Street', 'phone' => '03344050495', 'cnic' => '1234679', 'role' => 'Receptionist', 'status' => 'Active', 'branch' => 'DHA', 'note' => 'MBBS Qualified', 'clinic_id' => 1]);
     DB::table('employees')->where('email', 'lab@gmail.com')->delete();
     Employee::create(['name' => 'Aqeel', 'password' => Hash::make('123456'), 'email' => 'lab@gmail.com', 'gender' => 'Male', 'age' => '23', 'city' => 'Lahore', 'country' => 'Pakistan', 'address' => '10 Down Street', 'phone' => '03344050495', 'cnic' => '1234679', 'role' => 'Lab Manager', 'status' => 'Active', 'branch' => 'DHA', 'note' => 'MBBS Qualified', 'clinic_id' => 1]);
 }
开发者ID:saqibtalib,项目名称:EMR-ex-,代码行数:15,代码来源:EmployeesTableSeeder.php

示例14: run

 public function run()
 {
     /*$faker = Faker::create();
     
     		foreach(range(1, 10) as $index)
     		{
     			Employee::create([
     
     			]);
     		}*/
     //采购
     Employee::create(['username' => 'CG001', 'password' => Hash::make('password'), 'no' => 'CG001', 'department_id' => 1, 'name' => '姚学勤', 'short_name' => 'YXQ', 'mobile' => '13588100301', 'right' => '', 'actived' => 1]);
     //销售
     Employee::create(['username' => 'XS001', 'password' => Hash::make('password'), 'no' => 'XS001', 'department_id' => 2, 'name' => '姚麦勤', 'short_name' => 'YMQ', 'mobile' => '13588100302', 'right' => '', 'actived' => 1]);
     //仓库
     Employee::create(['username' => 'CK001', 'password' => Hash::make('password'), 'no' => 'CK001', 'department_id' => 3, 'name' => '姚力勤', 'short_name' => 'YLQ', 'mobile' => '13588100303', 'right' => '', 'actived' => 1]);
     //财务
     Employee::create(['username' => 'CW001', 'password' => Hash::make('password'), 'no' => 'CW001', 'department_id' => 4, 'name' => '姚书勤', 'short_name' => 'YSQ', 'mobile' => '13588100304', 'right' => '', 'actived' => 1]);
 }
开发者ID:yanguanglan,项目名称:sz,代码行数:19,代码来源:EmployeesTableSeeder.php

示例15: createEmp

 public function createEmp()
 {
     $employees = Employee::create(array('strEmpID' => Input::get('empID'), 'strEmpFName' => Input::get('empfName'), 'strEmpLName' => Input::get('emplName'), 'strEmpStatus' => Input::get('empStatus'), 'strEmpAddress' => Input::get('empAdd'), 'strEmpBrchID' => Input::get('empBrnch'), 'strEmpRoleID' => Input::get('empRole')));
     $employees->save();
     return Redirect::to('/employees');
 }
开发者ID:ExperimentalGroup,项目名称:inventory,代码行数:6,代码来源:HomeController.php


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