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


PHP Employee::create方法代码示例

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


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

示例1: save

 /**
  * Saves new/existing employee to database and returns status in json response
  *
  * @param Request $request
  * @return array
  */
 public function save(Request $request)
 {
     $id = $request->input('id');
     if (null != $id) {
         $employee = $this->employee->find($id);
         $employee->fill($request->all());
     } else {
         $employee = $this->employee->create($request->all());
     }
     if ($employee->save()) {
         return ['status' => 200];
     }
     return ['status' => 500];
 }
开发者ID:emaslak,项目名称:simpleHR,代码行数:20,代码来源:EmployeeController.php

示例2: testChildModelDefaultsType

 public function testChildModelDefaultsType()
 {
     $data = factory(User::class)->make()->toArray();
     unset($data['type']);
     $employee = Employee::create($data + ['password' => 'testing']);
     $this->assertEquals(Employee::class, $employee->type);
 }
开发者ID:tonysm,项目名称:laravel-sti,代码行数:7,代码来源:ExampleTest.php

示例3: store

 /**
  * Store a newly created resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @return \Illuminate\Http\Response
  */
 public function store(Request $request)
 {
     //
     $employee = $request->all();
     return Employee::create($employee);
     /*$employees = DB::select(DB::raw("select employee.id,employee.name, employee.status, employee.wage, employee.designation, employee.joinedDate from employee "));
       $data = json_encode(array('employees'=>$employees));
       return $data;*/
 }
开发者ID:AshishXhrestha,项目名称:goe,代码行数:15,代码来源:EmployeeController.php

示例4: store

 /**
  * Store a newly created resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @return \Illuminate\Http\Response
  */
 public function store(Requests\EmployeeRequest $request)
 {
     //
     $data = $request->except('_token');
     $data['user_id'] = \Auth::User()->id;
     $employee = new Employee();
     $employee->create($data);
     return back();
 }
开发者ID:sunhuang2015,项目名称:mytask,代码行数:15,代码来源:EmployeeController.php

示例5: store

 /**
  * Store a newly created resource in storage.
  * We need to import Illuminate\Http\Request classfor the CreateEmployeeRequest
  * @param CreateEmployeeRequest|CreatePhonebookContactRequest|Request $request
  * @return \Illuminate\Http\Response
  */
 public function store(CreatePhonebookContactRequest $request)
 {
     // if the validation succed, the store() method is executed
     // On fail, the store() method never created and we are redirected to the previous route to correct the errors
     // Fetch the http post request ($request) from create.blade.php as an array of column and value pairs representing the columns that should be stored to the DB
     Employee::create($request->input());
     // when the data have been stored into the DB, we are redirected to index
     return redirect(route('phonebook.contact.index'));
 }
开发者ID:iraklisg,项目名称:AppTree,代码行数:15,代码来源:PhonebookController.php

示例6: store

 /**
  * Store a newly created resource in storage.
  *
  * @param  Request  $request
  * @return Response
  */
 public function store(Request $request)
 {
     $input = $request->all();
     $employee = \App\Employee::create($input);
     $project_id = $request->input('project');
     $date_start = $request->input('starting_date');
     $role = $request->input('function');
     $employee->projects()->attach($project_id, ['date_start' => $date_start]);
     Session::flash('flash_message', 'Employee successfully added!');
     return redirect()->back();
 }
开发者ID:gabrico92,项目名称:adc-app,代码行数:17,代码来源:EmployeesController.php

示例7: store

 public function store(Request $request)
 {
     //        return $request->photo;
     $this->validate($request, ['name' => 'required', 'present_address' => 'required', 'permanent_address' => 'required', 'mobile' => 'required|numeric', 'national_id' => 'required|numeric', 'designation' => 'required', 'raid' => 'required|numeric', 'status' => 'required|boolean', 'email' => 'email']);
     $employee = Employee::create($request->all());
     if ($request->photo) {
         $employee->photo = $this->upload();
     }
     $employee->save();
     return redirect()->to('/hr/employee');
 }
开发者ID:jubaedprince,项目名称:rkt,代码行数:11,代码来源:EmployeeController.php

示例8: store

 /**
  * Store a newly created resource in storage.
  *
  * @param  Request  $request
  * @return Response
  */
 public function store(Request $request)
 {
     // dd($request->all());
     if ($this->validator($request->all())->fails()) {
         flash()->error("Ooppss! You've got an error. Check the fields below.");
         return redirect()->back()->withInput();
     } else {
         Employee::create($request->all());
         flash()->success("Employee successfully added!");
     }
     return redirect()->back();
 }
开发者ID:rosemalejohn,项目名称:hpo-hris,代码行数:18,代码来源:EmployeeController.php

示例9: save

 public function save()
 {
     $data = Request::input('data');
     Candidate::find($data['id'])->update(['status_record_id' => $data['status_record_id'], 'time_interview' => $data['time_interview'], 'time' => $data['time']]);
     if ($data['employee_id'] != '') {
         Candidate::find($data['id'])->employees()->sync($data['employee_id']);
     }
     if ($data['status_record_id'] == 2) {
         $candidate = Candidate::find($data['id']);
         Employee::create(['firstname' => $candidate->first_name, 'lastname' => $candidate->last_name, 'phone' => $candidate->phone, 'email' => $candidate->email, 'position_id' => $data['position'], 'date_of_birth' => $candidate->date_of_birth]);
     }
 }
开发者ID:phanngoc,项目名称:internal-tool,代码行数:12,代码来源:InterviewController.php

示例10: store

 public function store(Request $request)
 {
     // dd($request->all());
     $password = $request->input('password');
     $card = $request->input('card') == "" ? 0 : $request->input('card');
     $name = $request->input('name');
     $all_users = Employee::where('device_id', $this->connected_device['device_id'])->orderBy('pin')->get();
     $next_pin = $this->unused_id($all_users);
     // send the employee to device and store it
     $this->tad->set_user_info(["pin" => $next_pin, "password" => $password, 'card' => $card, 'name' => $name, "group" => "1"]);
     // store the employee to DB
     $employee = Employee::create(['pin' => $next_pin, 'name' => $name, 'device_id' => $this->connected_device['device_id'], 'password' => $password, 'card' => $card]);
     $employee->save();
     return redirect()->action('EmployeesController@index');
 }
开发者ID:hew86i,项目名称:timeattd,代码行数:15,代码来源:EmployeesController.php

示例11: store

 /**
  * Store a newly created resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @return \Illuminate\Http\Response
  */
 public function store(Request $request)
 {
     //
     /*
     *  $table->string('number')->unique();
        $table->string('name');
        $table->string('email')->nullable();
        $table->integer('company_id')->unsigned();
        $table->string('department_name')->nullable();
        $table->string('costcent')->nullable();
        $table->integer('category_id')->unsigned();
        $table->integer('status_id')->unsigned();
     */
     $data = $request->except(['_token', 'bankaccount', 'bankinfo', 'attachment', 'level_id']);
     //dd($data);
     Employee::create($data);
     return back();
 }
开发者ID:sunhuang2015,项目名称:feotask,代码行数:24,代码来源:EmployeeController.php

示例12: run

 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     // $this->call(UserTableSeeder::class);
     Model::unguard();
     DB::table('users')->delete();
     DB::table('admins')->delete();
     DB::table('employees')->delete();
     DB::table('entries')->delete();
     $users = array(['name' => 'Ryan Chenkie', 'email' => 'ryanchenkie@gmail.com', 'password' => bcrypt('secret'), 'type' => 1], ['name' => 'Chris Sevilleja', 'email' => 'chris@scotch.io', 'password' => bcrypt('secret'), 'type' => 3], ['name' => 'Holly Lloyd', 'email' => 'holly@scotch.io', 'password' => bcrypt('secret'), 'type' => 2], ['name' => 'Adnan Kukic', 'email' => 'adnan@scotch.io', 'password' => bcrypt('secret'), 'type' => 2]);
     // Loop through each user above and create the record for them in the database
     foreach ($users as $user) {
         User::create($user);
     }
     Employee::create(['type' => 1, 'user_id' => 3]);
     Employee::create(['type' => 2, 'user_id' => 4]);
     Admin::create(['type' => 1, 'user_id' => 1]);
     Entry::create(['timeIn' => Carbon::now(), 'user_id' => 2]);
     Model::reguard();
 }
开发者ID:nq2916,项目名称:jot,代码行数:24,代码来源:DatabaseSeeder.php

示例13: create

 /**
  * Create a new user instance after a valid registration.
  *
  * @param  array  $data
  * @return User
  */
 protected function create(array $data)
 {
     $newUser = User::create(['username' => $data['username'], 'password' => bcrypt($data['password']), 'created_at' => gmdate('Y-m-d H:i:s'), 'updated_at' => gmdate('Y-m-d H:i:s'), 'userTypeId' => $data['userTypeId']]);
     $userTypeId = $newUser->userTypeId;
     if ($userTypeId == 1 || $userTypeId == 2) {
         $newEmployee = Employee::create(['userId' => $newUser->id, 'firstName' => $data['firstName'], 'lastName' => $data['lastName'], 'email' => $data['email'], 'phone' => $data['phone'], 'streetAddress' => $data['streetAddress'], 'city' => $data['city'], 'state' => $data['state'], 'zipcode' => $data['zipcode'], 'ssn' => $data['ssn'], 'hourlyRate' => $data['hourlyRate'], 'primaryStoreId' => $data['primaryStoreId']]);
     }
     if ($userTypeId == 3) {
         if (array_key_exists('accountId', $data)) {
             $newContact = Contact::create(['userId' => $newUser->id, 'accountId' => $data['accountId'], 'firstName' => $data['firstName'], 'lastName' => $data['lastName'], 'email' => $data['email'], 'phone' => $data['phone'], 'contactTypeId' => $data['contactTypeId']]);
         } else {
             $newAccount = Account::create(['companyName' => $data['companyName'], 'streetAddress' => $data['streetAddress'], 'city' => $data['city'], 'state' => $data['state'], 'zipcode' => $data['zipcode'], 'accountStatus' => $data['accountStatus']]);
             $accntId = $newAccount->id;
             $newContant = Contact::create(['userId' => $newUser->id, 'accountId' => $accntId, 'firstName' => $data['firstName'], 'lastName' => $data['lastName'], 'email' => $data['email'], 'phone' => $data['phone'], 'contactTypeId' => $data['contactTypeId']]);
             $newBalance = Balance::create(['accountId' => $accntId, 'balance' => 0.0]);
         }
     }
     return $newUser;
 }
开发者ID:JesHerArt,项目名称:ASL,代码行数:25,代码来源:AuthController.php

示例14: import

 public function import()
 {
     /************* Base ***********/
     Excel::load('data/base_stcs.csv', function ($reader) {
         foreach ($reader->get() as $employee) {
             Employee::create(["no_emp" => $employee->noemp, "first_name" => ucwords(mb_strtolower($employee->nombre, 'UTF-8')), "last_name" => '', "gender" => "f", "status" => 1, "payrollID" => 3, "syndicateID" => 1]);
         }
     });
     Excel::load('data/base_sthcs.csv', function ($reader) {
         foreach ($reader->get() as $employee) {
             Employee::create(["no_emp" => $employee->noemp, "first_name" => ucwords(mb_strtolower($employee->nombre, 'UTF-8')), "last_name" => '', "gender" => "f", "status" => 1, "payrollID" => 3, "syndicateID" => 2]);
         }
     });
     Excel::load('data/base_sitcs.csv', function ($reader) {
         foreach ($reader->get() as $employee) {
             Employee::create(["no_emp" => $employee->noemp, "first_name" => ucwords(mb_strtolower($employee->nombre, 'UTF-8')), "last_name" => '', "gender" => "f", "status" => 1, "payrollID" => 3, "syndicateID" => 3]);
         }
     });
     return Employee::all();
 }
开发者ID:Alexsflores,项目名称:rtcs,代码行数:20,代码来源:ImportCSVController.php

示例15: run

 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     DB::table('employees')->delete();
     $faker = \Faker\Factory::create();
     /**
      * this for admin account
      */
     $emp = Employee::create(['user_id' => 801, 'name' => 'Robinson L. Legaspi', 'department' => 'quality_assurance', 'station' => 'DCC', 'position' => 'Management System Officer', 'email' => 'robinsonlegaspi@astigp.com', 'status' => 'active']);
     User::create(['employee_id' => 801, 'access_level' => 'admin', 'password' => 'admin', 'avatar' => 'default.png']);
     Question::create(['user_id' => $emp->user_id, 'question' => 'What are you?', 'answer' => 'user']);
     /**
      * this for process account
      */
     $emp = Employee::create(['user_id' => 802, 'name' => 'Nepthal Dave S. Pakingan', 'department' => 'process_engineering', 'station' => 'Process Engineer', 'position' => 'HR Programmer', 'email' => 'robinsonlegaspi@astigp.com', 'status' => 'active']);
     User::create(['employee_id' => 802, 'access_level' => 'signatory', 'password' => 'user', 'avatar' => 'default.png']);
     Question::create(['user_id' => $emp->user_id, 'question' => 'What are you?', 'answer' => 'user']);
     /**
      * this for process account
      */
     $emp = Employee::create(['user_id' => 4550, 'name' => 'Pauleen Moya', 'department' => 'production', 'station' => 'PL1', 'position' => 'Supervisor', 'email' => 'moya@astigp.com', 'status' => 'active']);
     User::create(['employee_id' => 4550, 'access_level' => 'signatory', 'password' => 'user', 'avatar' => 'default.png']);
     Question::create(['user_id' => $emp->user_id, 'question' => 'What are you?', 'answer' => 'user']);
     /**
      * this for dummy account
      */
     foreach (range(1, 200) as $index) {
         $department = $faker->randomElement(['production', 'process_engineering', 'quality_assurance', 'other_department']);
         $station['quality_assurance'] = ['quality assurance'];
         $station['process_engineering'] = ['process engineering'];
         $station['production'] = ['pl1', 'pl2', 'pl3', 'pl4', 'pl7', 'pl9'];
         $station['other_department'] = ['equipment engineering', 'facilities', 'mis', 'human resource', 'purchasing and logistics', 'finance', 'utilities'];
         $emp = Employee::create(['user_id' => $faker->unique()->randomNumber, 'name' => $faker->name('male' | 'female'), 'department' => $department, 'station' => $faker->randomElement($station[$department]), 'position' => $faker->randomElement(['Supervisor', 'Operator', 'Manager']), 'status' => $faker->randomElement(['active', 'resigned']), 'email' => $faker->email]);
         User::create(['employee_id' => $emp->user_id, 'access_level' => $faker->randomElement(['user', 'signatory']), 'password' => '8d', 'avatar' => 'default.png']);
         Question::create(['user_id' => $emp->user_id, 'question' => 'What are you?', 'answer' => 'user']);
     }
 }
开发者ID:rob1121,项目名称:qdn,代码行数:41,代码来源:employeeSeeder.php


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