コード例 #1
0
 public function run()
 {
     $faker = Faker::create();
     foreach (range(1, 10) as $index) {
         Employee::create([]);
     }
 }
コード例 #2
0
 /**
  * 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');
 }
コード例 #3
0
 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);
 }
コード例 #4
0
 public function run()
 {
     DB::table('employees')->truncate();
     Employee::create(['firstname' => 'Guido', 'lastname' => 'Bergman', 'email' => '*****@*****.**', 'password' => Hash::make('secret'), 'admin' => 'true']);
     Employee::create(['firstname' => 'Rob', 'lastname' => 'Gloudemans', 'email' => '*****@*****.**', 'password' => Hash::make('secret'), 'admin' => 'false']);
     Employee::create(['firstname' => 'Peter', 'lastname' => 'Klaassen', 'email' => '*****@*****.**', 'password' => Hash::make('secret'), 'admin' => 'false']);
     Employee::create(['firstname' => 'Dave', 'lastname' => 'van der Donk', 'email' => '*****@*****.**', 'password' => Hash::make('secret'), 'admin' => 'false']);
 }
コード例 #5
0
 /** @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]);
 }
コード例 #6
0
 /**
  * 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');
 }
コード例 #7
0
 /**
  * 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()));
     }
 }
コード例 #8
0
 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');
     }
 }
コード例 #9
0
 /**
  * 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');
 }
コード例 #10
0
 /**
  * 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');
 }
コード例 #11
0
 /**
  * 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();
     }
 }
コード例 #12
0
 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' => '*****@*****.**', 'created_by' => 'Developer'));
     $user = User::create(array('username' => 'employee', 'password' => Hash::make('employee'), 'user_level' => 'employee123', 'email' => '*****@*****.**', '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();
 }
コード例 #13
0
 public function run()
 {
     DB::table('employees')->where('email', '*****@*****.**')->delete();
     Employee::create(['name' => 'Fahad Ali', 'password' => Hash::make('123456'), 'email' => '*****@*****.**', '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', '*****@*****.**')->delete();
     Employee::create(['name' => 'Shah', 'password' => Hash::make('123456'), 'email' => '*****@*****.**', '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', '*****@*****.**')->delete();
     Employee::create(['name' => 'Ali', 'password' => Hash::make('123456'), 'email' => '*****@*****.**', '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', '*****@*****.**')->delete();
     Employee::create(['name' => 'Umer', 'password' => Hash::make('123456'), 'email' => '*****@*****.**', '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', '*****@*****.**')->delete();
     Employee::create(['name' => 'Talal', 'password' => Hash::make('123456'), 'email' => '*****@*****.**', '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', '*****@*****.**')->delete();
     Employee::create(['name' => 'Aqeel', 'password' => Hash::make('123456'), 'email' => '*****@*****.**', '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]);
 }
コード例 #14
0
 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]);
 }
コード例 #15
0
 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');
 }
コード例 #16
0
 public static function appendEmployee($data)
 {
     Employee::create(array('eid' => $data->eid, 'ename' => $data->ename, 'ebirth' => $data->ebirth, 'egender' => $data->egender, 'etel' => $data->etel, 'eemail' => $data->eemail, 'eaddress' => $data->eaddress, 'dcode' => $data->dcode, 'rcode' => $data->rcode));
 }
コード例 #17
0
 public function run()
 {
     Employee::create(['name' => 'Trần Phú Vinh', 'address' => '157 Tôn Đức Thắng', 'phone' => 01234567, 'email' => '*****@*****.**']);
 }
コード例 #18
0
 public function userinfo($start)
 {
     $query = new Query('USERINFO', $this->dbh);
     $query->where('USERID', '>', $start);
     $query->order('USERID');
     $result = $query->get('USERID,SSN,Name,Gender,BIRTHDAY,street,DEFAULTDEPTID');
     foreach ($result as $row) {
         Employee::create(['id' => $row['USERID'], 'ssn' => $row['SSN'], 'name' => $row['Name'], 'is_male' => $row['Gender'] == 'Male' ? 1 : 0, 'birthday' => $row['BIRTHDAY'], 'street' => $row['street'], 'department_id' => $row['DEFAULTDEPTID']]);
     }
     $size = count($result);
     $this->num_data += $size;
     return $size > 0 ? $result[$size - 1]['USERID'] : $start;
 }
コード例 #19
0
 public function create()
 {
     if (!empty($_POST['lname']) && !empty($_POST['fname']) && !empty($_POST['gender']) && !empty($_POST['mstatus']) && !empty($_POST['religion']) && !empty($_POST['dob']) && !empty($_POST['nationality']) && !empty($_POST['soo']) && !empty($_POST['address'])) {
         $applicant = new Employee();
         if (isset($_FILES['fupload']) && $_FILES['fupload']['error'] == 0) {
             //if file upload is set
             move_uploaded_file($_FILES['fupload']['tmp_name'], "public/uploads/" . basename($_FILES['fupload']['name']));
             $image = new Imageresize();
             // an instance of image resize object
             $image->load("public/uploads/" . basename($_FILES['fupload']['name']));
             //$image->image =;
             $image->resize(400, 400);
             $image->save("public/uploads/" . basename($_FILES['fupload']['name']));
             //this section is needed to get the extension for image type in renaming the image
             if ($_FILES['fupload']['type'] == "image/gif") {
                 $ext = ".gif";
             }
             if ($_FILES['fupload']['type'] == "image/png") {
                 $ext = ".png";
             }
             if ($_FILES['fupload']['type'] == "image/jpeg") {
                 $ext = ".jpeg";
             }
             if ($_FILES['fupload']['type'] == "image/pjpeg") {
                 $ext = ".jpeg";
             }
             if ($_FILES['fupload']['type'] == "image/gif") {
                 $ext = ".gif";
             }
             if ($_FILES['fupload']['type'] == "image/jpg") {
                 $ext = ".jpg";
             }
             $new_name = uniqid() . "_" . time() . $ext;
             //new name for the image
             rename("public/uploads/" . basename($_FILES['fupload']['name']), "public/uploads/" . $new_name);
             $photo = $new_name;
             $applicant->img_url = $photo;
         } else {
             //$applicant->img_url = $_POST['imgvalue'];
         }
         $applicant->emp_lname = $_POST['lname'];
         $applicant->emp_fname = $_POST['fname'];
         $applicant->emp_mname = $_POST['mname'];
         $applicant->emp_sex = $_POST['gender'];
         $applicant->emp_mstatus = $_POST['mstatus'];
         $applicant->emp_religion = $_POST['religion'];
         $applicant->emp_dob = $_POST['dob'];
         $applicant->emp_nationality = $_POST['nationality'];
         $applicant->emp_soo = $_POST['soo'];
         $applicant->emp_lga = $_POST['lga'];
         $applicant->emp_address = $_POST['address'];
         $applicant->emp_email = $_POST['email'];
         $applicant->emp_phone = $_POST['phone'];
         $applicant->emp_uname = $_POST['email'];
         $applicant->emp_pword = crypt(Employee::generatePassword(8, 2), '$2a$07$usesomesillystringforsalt$');
         $applicant->emp_id = Employee::getID2("RJH/S/", "tblemp", $applicant->emp_fname . " " . $applicant->emp_lname);
         $applicant->datecreated = date("Y-m-d H:i:s");
         if ($applicant->create()) {
             $this->sendMail($applicant->fname, $applicant->lname, $applicant->emp_mname, $applicant->emp_pword, $applicant->emp_uname, $applicant->emp_email);
             return 1;
             //returns 1 on success
         } else {
             return 2;
             // returns 2 on insert error
         }
     } else {
         return 3;
         //returns 3 if requiered input field is not supplied
     }
 }
コード例 #20
0
 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();
     /*$account = Login::create(array(
     			'strUsername' => Input::get('newEmpUName'),
     			'strPassword' => Input::get('newEmpPass'),
     			'strLoginEmpID' => Input::get('empID')
     		));
     		$account->save();*/
     return Redirect::to('/employees');
 }