/**
  * 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 #2
0
 /**
  * 娱乐公司的所有职员
  */
 public function getStaffs()
 {
     $entertainid = $this->id ? $this->id : 0;
     return StaffModel::where('entertain_id', $entertainid)->get();
 }