| 123456789101112131415161718192021222324252627282930313233343536373839404142434445 |
- <?php
- use Illuminate\Database\Migrations\Migration;
- use Illuminate\Database\Schema\Blueprint;
- use Illuminate\Support\Facades\Schema;
- class CreateDeliveryAppointmentsTable extends Migration
- {
- public $authorities = [
- "入库管理-盘收一体-客户预约",
- ];
- /**
- * Run the migrations.
- *
- * @return void
- */
- public function up()
- {
- Schema::create('delivery_appointments', function (Blueprint $table) {
- $table->id();
- $table->timestamps();
- });
- foreach ($this->authorities as $authority){
- \App\Authority::query()->firstOrCreate([
- "name"=>$authority
- ],[
- "name"=>$authority,
- "alias_name"=>$authority
- ]);
- }
- }
- /**
- * Reverse the migrations.
- *
- * @return void
- */
- public function down()
- {
- Schema::dropIfExists('delivery_appointments');
- foreach ($this->authorities as $authority){
- \App\Authority::query()->where("name",$authority)->delete();
- }
- }
- }
|