function CreateStaffTables($types)
 {
     $staffModel = new StaffModel();
     $staffArray = $staffModel->GetStaffByType($types);
     $result = "";
     foreach ($staffArray as $key => $staff) {
         $result = $result . "<table class = 'customerTable'>\n                        <tr>\n                           \n                            \n                            \n                            <th width = '75px' >StaffId : </th>\n                            <td>{$staff->StaffId}</td>\n                        </tr>\n                          \n                        <tr>\n                            <th width = '75px' >Staff Name : </th>\n                            <td>{$staff->StaffName}</td>\n                        </tr>\n                        \n                        <tr>\n                            <th>Address : </th>\n                            <td>{$staff->Address}</td>\n                        </tr>\n                        \n                        <tr>\n                            <th>Contact Number : </th>\n                            <td>{$staff->ContactNo}</td>\n                        </tr>\n                        \n\n                             <tr>\n                            <th>Branch Number : </th>\n                            <td>{$staff->BranchNo}</td>\n                        </tr>\n                        \n                            \n                       \n      \n                                         \n                     </table>";
     }
     return $result;
 }
 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']);
         }
     }
 }
 /**
  * Run the migrations.
  *
  * @return void
  */
 public function up()
 {
     Schema::create('locations', function (Blueprint $table) {
         $table->increments('id');
         $table->string('name');
         $table->text('address');
         $table->string('phone');
         $table->string('url');
         $table->timestamps();
         $table->softDeletes();
     });
     Schema::table('services', function (Blueprint $table) {
         $table->dropColumn('location');
         $table->integer('location_id')->nullable()->after('description');
     });
     Schema::table('staff_appointments', function (Blueprint $table) {
         $table->integer('location_id')->after('service_id');
     });
     Schema::table('staff_appointments_recurring', function (Blueprint $table) {
         $table->integer('location_id')->after('service_id');
     });
     Schema::table('staff_schedules', function (Blueprint $table) {
         $table->integer('location_id')->after('availability');
     });
     // Fill the locations table
     $this->populateTables();
     // Get staff instructors
     $instructors = StaffModel::where('instruction', (int) true)->get();
     foreach ($instructors as $instructor) {
         foreach ($instructor->schedule as $day) {
             $day->fill(['location_id' => 1])->save();
         }
     }
     // Update all the staff appointments
     StaffAppointmentModel::query()->update(['location_id' => 1]);
 }
Exemple #6
0
 /**
  * 娱乐公司的所有职员
  */
 public function getStaffs()
 {
     $entertainid = $this->id ? $this->id : 0;
     return StaffModel::where('entertain_id', $entertainid)->get();
 }