public function run() { $faker = Faker\Factory::create(); $access = [1 => 'staff', 2 => 'associate']; for ($i = 0; $i < 5; $i++) { $user = UserModel::create(['name' => $faker->firstName . " " . $faker->lastName, 'email' => $faker->safeEmail, 'password' => 'password', 'phone' => '']); $staff = StaffModel::create(['user_id' => $user->id, 'title' => '', 'access' => $faker->numberBetween(1, 2), 'instruction' => (int) true]); Artisan::call('scheduler:services', ['staff' => $staff->id, 'level' => $access[$staff->access]]); } }
public function run() { $users = array(array('name' => "Brian Jacobs", 'email' => "*****@*****.**", 'password' => "nikegolf", 'phone' => '585-415-9323', 'address' => '284 Chambers St. Spencerport, NY'), array('name' => "David VanScott", 'email' => "*****@*****.**", 'password' => "alpha312", 'phone' => '585-576-8260', 'address' => '2145 East Ave. Apt H Rochester, NY 14610')); foreach ($users as $user) { UserModel::create($user); } $staff = array(array('user_id' => 1, 'access' => 2, 'title' => "Senior Instructor", 'instruction' => (int) true), array('user_id' => 2, 'access' => 3, 'title' => "Web Developer")); foreach ($staff as $s) { $item = StaffModel::create($s); // Create general availability for ($d = 0; $d <= 6; $d++) { StaffScheduleModel::create(array('staff_id' => $item->id, 'day' => $d, 'availability' => '9:00-17:00')); } } }
protected function populateTables() { $users = [['name' => "Brian Jacobs", 'email' => "*****@*****.**", 'password' => "nikegolf", 'phone' => '585-415-9323', 'address' => '284 Chambers St. Spencerport, NY'], ['name' => "David VanScott", 'email' => "*****@*****.**", 'password' => "alpha312", 'phone' => '585-576-8260', 'address' => '2145 East Ave. Apt H Rochester, NY 14610']]; foreach ($users as $user) { UserModel::create($user); } $staff = [['user_id' => 1, 'access' => 3, 'title' => "Director of Instruction", 'instruction' => (int) true], ['user_id' => 2, 'access' => 4, 'title' => "Web Developer"]]; foreach ($staff as $s) { $item = StaffModel::create($s); // Create general availability for ($d = 0; $d <= 6; $d++) { StaffScheduleModel::create(['staff_id' => $item->id, 'day' => $d, 'availability' => '9:00-17:00']); } } }