public function run() { $faker = Faker\Factory::create(); // change this to auto create more leave balance records for each user $user_count = 19; // change this if you add or remove a leave type $parents_count = 2; foreach (range(1, $user_count) as $user_id) { foreach (range(1, $parents_count) as $parents_id) { Parents::create(['user_id' => $user_id, 'parent_id' => $parents_id, 'firstname' => $faker->firstName, 'middlename' => $faker->lastName, 'lastname' => $faker->lastName, 'address' => $faker->streetAddress]); } } }
public function postRegister() { $validator = Validator::make(Input::all(), User::$rules); if ($validator->fails()) { return Redirect::route('register')->withErrors($validator)->withInput(); } $user = User::create(['firstname' => Input::get('firstname'), 'middlename' => Input::get('middlename'), 'lastname' => Input::get('lastname'), 'email' => Input::get('email'), 'username' => Input::get('username'), 'password' => Hash::make(Input::get('password')), 'department_id' => Input::get('department_id'), 'birthday' => Input::get('birthday'), 'birthplace' => Input::get('birthplace'), 'gender' => Input::get('gender'), 'civilstatus' => Input::get('civilstatus'), 'citizenship' => Input::get('citizenship'), 'height' => Input::get('height'), 'weight' => Input::get('weight'), 'bloodtype' => Input::get('bloodtype'), 'datehired' => Input::get('datehired'), 'pos_id' => Input::get('pos_id'), 'status' => Input::get('status')]); // $user->department()->attach(Input::get('department_id')); $lastid = User::orderBy('id', 'desc')->first(); $contacts = ContactInfo::create(['user_id' => $lastid->id, 'homenum' => Input::get('homenum'), 'officenum' => Input::get('officenum'), 'mobilenum' => Input::get('mobilenum'), 'street' => Input::get('street'), 'city' => Input::get('city')]); $commonid = CommonId::create(['user_id' => $lastid->id, 'tin' => input::get('taxid'), 'philhealth' => input::get('philhealth'), 'pagibig' => input::get('pagibig'), 'sss' => input::get('sss'), 'gsisbp' => input::get('gsisbp'), 'gsispolicy' => input::get('gsispol'), 'gsisoptional' => input::get('gsisopt'), 'educplan' => input::get('educplan')]); $father = Parents::create(['user_id' => $lastid->id, 'parent_id' => Input::get('fatherid'), 'firstname' => Input::get('fatherfirstname'), 'middlename' => Input::get('fathermiddlename'), 'lastname' => Input::get('fatherlastname'), 'address' => Input::get('fatheraddress')]); $mother = Parents::create(['user_id' => $lastid->id, 'parent_id' => Input::get('motherid'), 'firstname' => Input::get('motherfirstname'), 'middlename' => Input::get('mothermiddlename'), 'lastname' => Input::get('motherlastname'), 'address' => Input::get('motheraddress')]); $vacleave = LeaveBalance::create(['user_id' => $lastid->id, 'balance' => 1.25, 'leavetype_id' => 1]); $sickleave = LeaveBalance::create(['user_id' => $lastid->id, 'balance' => 1.25, 'leavetype_id' => 2]); $patleave = LeaveBalance::create(['user_id' => $lastid->id, 'leavetype_id' => 3]); $patleave = LeaveBalance::create(['user_id' => $lastid->id, 'leavetype_id' => 4]); $birthleave = LeaveBalance::create(['user_id' => $lastid->id, 'leavetype_id' => 5]); $school = School::create(['user_id' => $lastid->id]); $evalpoints = EvaluatePoints::create(['user_id' => $lastid->id]); $audit = AuditTrail::create(['user_id' => Auth::id(), 'role' => 'Employee Management Admin', 'action' => 'registered a new EMPLOYEE "' . $lastid->firstname . ' ' . $lastid->lastname . '".']); return Redirect::route('register')->with('alert', 'success|' . $user->formatName(':fn :mi :ln') . ' has been registered successfully.'); }