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


PHP Employee::save方法代码示例

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


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

示例1: store

 /**
  * Store a newly created resource in storage.
  *
  * @return Response
  */
 public function store()
 {
     $input = Input::all();
     $rules = array('tool_name' => 'required', 'acc_name' => 'required', 'emp_id' => 'required', 'emp_name' => 'required', 'access' => 'required');
     $messages = array('tool_name.required' => 'Tool Name is required !', 'emp_id.required' => 'Employee ID is required !', 'emp_name.required' => 'Employee Name is required !', 'access.required' => 'Please select an accesibility !');
     $validation = Validator::make($input, $rules, $messages);
     if ($validation->passes()) {
         $toolname = Accounts::select('account_name')->where('id', '=', Input::get('acc_name'))->get();
         foreach ($toolname as $key => $tool) {
             $accName = $tool->account_name;
         }
         //print_r($account_name);
         //exit;
         $employees = new Employee();
         $employees->emp_id = Input::get('emp_id');
         $employees->emp_name = Input::get('emp_name');
         $employees->acc_id = Input::get('acc_name');
         $employees->tool_name = Input::get('tool_name');
         $employees->access = Input::get('access');
         $employees->save();
         return Redirect::to('/employees');
     } else {
         return Redirect::to('/employees/create')->withErrors($validation);
     }
 }
开发者ID:avinash-,项目名称:idtv2,代码行数:30,代码来源:EmployeeController.php

示例2: store

 /**
  * Store a newly created resource in storage.
  *
  * @return Response
  */
 public function store()
 {
     // $validation = Employee::validate(Input::all());
     $input = Input::all();
     $rules = array('first_name' => 'required|max:20', 'last_name' => 'required|max:20', 'email' => 'required|email|unique:employees,email', 'username' => 'required|unique:employees,username', 'password' => 'required|confirmed', 'password_confirmation' => 'required', 'phone_number' => 'required|numeric');
     $validation = Validator::make($input, $rules);
     if ($validation->passes()) {
         $employee = new Employee();
         $employee->first_name = Input::get('first_name');
         $employee->last_name = Input::get('last_name');
         $employee->email = Input::get('email');
         $employee->username = Input::get('username');
         $employee->password = Hash::make(Input::get('password'));
         $employee->phone_number = Input::get('phone_number');
         $employee->address1 = Input::get('address1');
         $employee->address2 = Input::get('address2');
         $employee->city = Input::get('city');
         $employee->state = Input::get('state');
         $employee->zip = Input::get('zip');
         $employee->country = Input::get('country');
         $employee->comment = Input::get('comment');
         $employee->save();
         // return "Success";
         Session::flash('success', 'A new employee has been created');
         return Redirect::to('/employees');
     } else {
         return Redirect::to('/employees/create')->withErrors($validation)->withInput();
     }
 }
开发者ID:nangei,项目名称:wpa8pos,代码行数:34,代码来源:EmployeeController.php

示例3: addAction

 /**
  * @desc - สำหรับรับค่าข้อมูล FORM ที่ส่งค่าข้อมูลจาก AJax แบบ Post
  * @return json
  */
 public function addAction()
 {
     //ปิดการใช้งานสำหรับการร้องขอ Ajax
     $this->view->disable();
     //ถ้ากดปุ่มโพสต์
     if ($this->request->isPost() == true) {
         //ถ้าส่งฝ่าน Ajax
         if ($this->request->isAjax() == true) {
             ////อนุญาตให้ส่งข้อมูลครั้งเดียวโดยใช้เงื่อนไขของ  token ตรวจสอบ
             if ($this->security->checkToken()) {
                 // สร้าง Model ข้อมูลตาราง Employee รับค่าข้อมูลจากการส่งข้อมูลภายใต้  FORM ที่มีส่งข้อมูล SSN, FNAME, LNAME, DNO
                 $employee = new Employee();
                 $employee->SSN = $this->request->getPost('SSN', array('striptags', 'trim'));
                 $employee->FNAME = $this->request->getPost('FNAME', array('striptags', 'trim'));
                 $employee->LNAME = $this->request->getPost('LNAME', array('striptags', 'trim'));
                 $employee->DNO = $this->request->getPost('DNO', array('striptags', 'trim'));
                 //รันคำสั่ง SQL insert into employee (SSN, FNAME, LNAME, DNO) value ($_POST['SSN'] ,$_POST['FNAME'] ...)
                 if ($employee->save()) {
                     $this->response->setJsonContent(array("res" => "success"));
                     //ระบุสถานะทำงานเสร็จโดยค่า Code 200 เพื่อส่งข้อมูลการทำงานสำเร็จ
                     $this->response->setStatusCode(200, "OK");
                 } else {
                     $this->response->setJsonContent(array("res" => "error"));
                     //ระบุสถานะทำงานผิดพลาดโดยค่า Code 500 เพื่อส่งข้อมูลการทำงานผิดพลาด
                     $this->response->setStatusCode(500, "Internal Server Error");
                 }
                 $this->response->send();
             }
         }
     }
 }
开发者ID:suebtas,项目名称:itphalcon,代码行数:35,代码来源:EmployeeController.php

示例4: postAddnewemp

 public function postAddnewemp()
 {
     $inputs = Input::all();
     if (!empty($inputs['fullname'])) {
         $photoNewName = null;
         // upload photo
         if (Input::hasFile('photo')) {
             $photo = Input::file('photo');
             $photoNewName = date('YmdHis') . '.' . $photo->getClientOriginalExtension();
             $photo->move('image/employee', $photoNewName);
         }
         $employee = new Employee();
         $employee->emp_name = $inputs['fullname'];
         $employee->emp_idcard = $inputs['cardid'];
         $employee->emp_address = $inputs['address'];
         $employee->emp_tel = $inputs['tel'];
         $employee->emp_lineid = $inputs['lineid'];
         $employee->emp_email = $inputs['email'];
         $employee->emp_image = $photoNewName;
         $employee->emp_username = $inputs['username'];
         $employee->emp_password = Hash::Make($inputs['password']);
         $employee->save();
         return Redirect::to('admin/employee/showallemployee')->with('alert', 'สร้างพนักงานสำเร็จ');
     }
     return Redirect::back();
 }
开发者ID:kuanblock,项目名称:posonline,代码行数:26,代码来源:EmployeeController.php

示例5: actionCreate

 /**
  * Creates a new model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  */
 public function actionCreate()
 {
     $model = new Employee();
     $user = new RbacUser();
     $disabled = "";
     // Uncomment the following line if AJAX validation is needed
     // $this->performAjaxValidation($model);
     if (Yii::app()->user->checkAccess('employee.create')) {
         if (isset($_POST['Employee'])) {
             $model->attributes = $_POST['Employee'];
             $user->attributes = $_POST['RbacUser'];
             //$location_id = $_POST['Employee']['location'];
             if ($_POST['Employee']['year'] !== "" || $_POST['Employee']['month'] !== "" || $_POST['Employee']['day'] !== "") {
                 $dob = $_POST['Employee']['year'] . '-' . $_POST['Employee']['month'] . '-' . $_POST['Employee']['day'];
                 $model->dob = $dob;
             }
             // validate BOTH $a and $b
             $valid = $model->validate();
             $valid = $user->validate() && $valid;
             if ($valid) {
                 $transaction = $model->dbConnection->beginTransaction();
                 try {
                     if ($model->save()) {
                         $user->employee_id = $model->id;
                         if ($user->save()) {
                             $assignitems = array('items', 'sales', 'employees', 'customers', 'suppliers', 'store', 'receivings', 'reports', 'invoices', 'payments');
                             foreach ($assignitems as $assignitem) {
                                 if (!empty($_POST['RbacUser'][$assignitem])) {
                                     foreach ($_POST['RbacUser'][$assignitem] as $itemId) {
                                         $authassigment = new Authassignment();
                                         $authassigment->userid = $user->id;
                                         $authassigment->itemname = $itemId;
                                         if (!$authassigment->save()) {
                                             $transaction->rollback();
                                             print_r($authassigment->errors);
                                         }
                                     }
                                 }
                             }
                             $transaction->commit();
                             Yii::app()->user->setFlash('success', '<strong>Well done!</strong> successfully saved.');
                             //$this->redirect(array('view', 'id' => $model->id));
                             $this->redirect(array('admin'));
                         } else {
                             Yii::app()->user->setFlash('error', '<strong>Oh snap!</strong> Change a few things up and try submitting again.');
                         }
                     }
                 } catch (Exception $e) {
                     $transaction->rollback();
                     Yii::app()->user->setFlash('error', '<strong>Oh snap!</strong> Change a few things up and try submitting again.' . $e);
                 }
             }
         }
     } else {
         throw new CHttpException(403, 'You are not authorized to perform this action');
     }
     $this->render('create', array('model' => $model, 'user' => $user, 'disabled' => $disabled));
 }
开发者ID:noonnightcoder,项目名称:bakou-pos-apsara,代码行数:62,代码来源:EmployeeController.php

示例6: actionCreate

 /**
  * 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]);
     }
 }
开发者ID:arrhkm,项目名称:da_basic,代码行数:14,代码来源:EmployeeController.php

示例7: Create

 public static function Create($name, $telephone, $email, $address, $gender, $department, $position, $salary)
 {
     $type = new PartyType('Employee');
     $employee = new Employee($type, $name, $telephone, $email, $address, $gender, $department, $position, $salary, 0);
     if ($employee->save()) {
         return $employee;
     }
     return false;
 }
开发者ID:xander-mbaka,项目名称:momentum,代码行数:9,代码来源:DomainHRM.php

示例8: store

 public function store()
 {
     $employee = new Employee();
     $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 menambahkan data pegawai!');
 }
开发者ID:emanmks,项目名称:oneschool,代码行数:12,代码来源:EmployeesController.php

示例9: actionCreate

 /**
  * Creates a new model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  */
 public function actionCreate()
 {
     $model = new Employee();
     // Uncomment the following line if AJAX validation is needed
     // $this->performAjaxValidation($model);
     if (isset($_POST['Employee'])) {
         $model->attributes = $_POST['Employee'];
         if ($model->save()) {
             $this->redirect(array('view', 'id' => $model->id));
         }
     }
     $this->render('create', array('model' => $model));
 }
开发者ID:Danny15,项目名称:moreyii,代码行数:17,代码来源:EmployeeController.php

示例10: createFakerEmployee

 protected function createFakerEmployee()
 {
     $faker = Faker::create();
     for ($i = 1; $i < 50; $i++) {
         $employee = new Employee();
         $employee->first_name = $faker->firstName;
         $employee->last_name = $faker->lastName;
         $employee->email = $faker->email;
         $employee->hire_date = $faker->date($format = 'Y-m-d');
         $employee->password = $faker->password;
         $employee->save();
     }
 }
开发者ID:ThomasNYoung,项目名称:phantom-reporter,代码行数:13,代码来源:EmployeesTableSeeder.php

示例11: run

 public function run()
 {
     $employee = new Employee();
     $employee->name = 'Ganesh';
     $employee->email = 'ganesh@oodoo.co.in';
     $employee->password = '00d00@ganesh';
     $employee->password_confirmation = '00d00@ganesh';
     $employee->mobile = '9999999999';
     $employee->active = 1;
     $employee->save();
     $employee::$rules = [];
     $employee->generateEmployeeId();
 }
开发者ID:testoodoo,项目名称:OoodooSiteUp,代码行数:13,代码来源:EmployeeSeeder.php

示例12: store

 /**
  * Store a newly created resource in storage.
  * POST /clinics
  *
  * @return Response
  */
 public function store()
 {
     $data = Input::all();
     $validator = Validator::make($data, array('password' => 'min:6', 'email' => 'unique:employees', 'status' => 'required', 'clinic_name' => 'required', 'clinic_address' => 'required'));
     if ($validator->fails()) {
         return Redirect::back()->withErrors($validator)->withInput();
     }
     $clinic = Clinic::create(['name' => $data['clinic_name'], 'address' => $data['clinic_address']]);
     $employee = new Employee();
     $employee->clinic_id = $clinic->id;
     $employee->name = Input::get('name');
     $employee->password = Hash::make(Input::get('password'));
     $employee->email = Input::get('email');
     $employee->gender = Input::get('gender');
     $employee->age = Input::get('age');
     $employee->city = Input::get('city');
     $employee->country = Input::get('country');
     $employee->address = Input::get('address');
     if (Input::get('phone') == '') {
         $employee->phone = 'N/A';
     } else {
         $employee->phone = Input::get('phone');
     }
     if (Input::get('cnic') == '') {
         $employee->cnic = 'N/A';
     } else {
         $employee->cnic = Input::get('cnic');
     }
     if (Input::get('branch') == '') {
         $employee->branch = 'N/A';
     } else {
         $employee->branch = Input::get('branch');
     }
     if (Input::get('note') == '') {
         $employee->note = 'N/A';
     } else {
         $employee->note = Input::get('note');
     }
     $employee->status = Input::get('status');
     $employee->role = 'Administrator';
     $employee->save();
     $data = ['link' => URL::to('login'), 'name' => Input::get('name')];
     //      Send email to employee
     Mail::queue('emails.welcome', $data, function ($message) {
         $message->to(Input::get('email'), Input::get('name'))->subject('Welcome to EMR!');
     });
     return Redirect::route('clinics.index');
 }
开发者ID:saqibtalib,项目名称:EMR-ex-,代码行数:54,代码来源:ClinicsController.php

示例13: doSave

 /**
  * Performs the work of inserting or updating the row in the database.
  *
  * If the object is new, it inserts it; otherwise an update is performed.
  * All related objects are also updated in this method.
  *
  * @param      PropelPDO $con
  * @return     int The number of rows affected by this insert/update and any referring fk objects' save() operations.
  * @throws     PropelException
  * @see        save()
  */
 protected function doSave(PropelPDO $con)
 {
     $affectedRows = 0;
     // initialize var to track total num of affected rows
     if (!$this->alreadyInSave) {
         $this->alreadyInSave = true;
         // We call the save method on the following object(s) if they
         // were passed to this object by their coresponding set
         // method.  This object relates to these object(s) by a
         // foreign key reference.
         if ($this->aRole !== null) {
             if ($this->aRole->isModified() || $this->aRole->isNew()) {
                 $affectedRows += $this->aRole->save($con);
             }
             $this->setRole($this->aRole);
         }
         if ($this->aEmployee !== null) {
             if ($this->aEmployee->isModified() || $this->aEmployee->isNew()) {
                 $affectedRows += $this->aEmployee->save($con);
             }
             $this->setEmployee($this->aEmployee);
         }
         if ($this->isNew()) {
             $this->modifiedColumns[] = UserPeer::ID;
         }
         // If this object has been modified, then save it to the database.
         if ($this->isModified()) {
             if ($this->isNew()) {
                 $pk = UserPeer::doInsert($this, $con);
                 $affectedRows += 1;
                 // we are assuming that there is only 1 row per doInsert() which
                 // should always be true here (even though technically
                 // BasePeer::doInsert() can insert multiple rows).
                 $this->setId($pk);
                 //[IMV] update autoincrement primary key
                 $this->setNew(false);
             } else {
                 $affectedRows += UserPeer::doUpdate($this, $con);
             }
             $this->resetModified();
             // [HL] After being saved an object is no longer 'modified'
         }
         $this->alreadyInSave = false;
     }
     return $affectedRows;
 }
开发者ID:lejacome,项目名称:hospital-mgt,代码行数:57,代码来源:BaseUser.php

示例14: store

 public static function store()
 {
     $params = $_POST;
     $services = Service::all();
     $attributes = array('name' => $params['name'], 'special' => $params['special'], 'introduction' => $params['introduction']);
     $employee = new Employee($attributes);
     $errors = $employee->errors();
     if (count($errors) == 0) {
         $employee->save();
         foreach ($services as $serv) {
             if (isset($_POST[$serv->id])) {
                 OfferedServicesController::create($employee->id, $serv->id);
             }
         }
         Redirect::to('/tyontekijat/' . $employee->id, array('message' => 'Työntekijä lisätty!'));
     } else {
         View::make('employee/new.html', array('errors' => $errors, 'attributes' => $attributes));
     }
 }
开发者ID:Zonsu,项目名称:Tsoha-Bootstrap,代码行数:19,代码来源:employee_controller.php

示例15: actionCreate

 /**
  * Creates a new model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  */
 public function actionCreate()
 {
     $model = new Employee();
     // Uncomment the following line if AJAX validation is needed
     // $this->performAjaxValidation($model);
     if (isset($_POST['Employee'])) {
         $model->attributes = $_POST['Employee'];
         if ($model->save()) {
             date_default_timezone_set("Asia/Manila");
         }
         $activity = new Activity();
         $activity->act_desc = 'Added Another Employee';
         $activity->act_datetime = date('Y-m-d G:i:s');
         $activity->act_by = User::model()->findByPK(Yii::app()->user->name)->emp_id;
         $activity->save();
         $this->redirect(array('view', 'id' => $model->emp_id));
     }
     $this->render('create', array('model' => $model));
 }
开发者ID:JexIboy,项目名称:lis-pglu,代码行数:23,代码来源:EmployeeController.php


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