|
|
@@ -0,0 +1,81 @@
|
|
|
+<?php
|
|
|
+
|
|
|
+use Illuminate\Database\Migrations\Migration;
|
|
|
+use Illuminate\Database\Schema\Blueprint;
|
|
|
+use Illuminate\Support\Facades\Schema;
|
|
|
+
|
|
|
+class ChangeAuthorityAddMethodIndex extends Migration
|
|
|
+{
|
|
|
+ /**
|
|
|
+ * Run the migrations.
|
|
|
+ *
|
|
|
+ * @return void
|
|
|
+ */
|
|
|
+ public function up()
|
|
|
+ {
|
|
|
+ Schema::table('authorities', function (Blueprint $table) {
|
|
|
+ $table->index("method","auth_method_index");
|
|
|
+ });
|
|
|
+ $auth = \App\Authority::query()->create([
|
|
|
+ "name" => "安卓端",
|
|
|
+ "parent_id" => null,
|
|
|
+ 'alias_name' => \Faker\Provider\Uuid::uuid(),
|
|
|
+ "permission" => "允许",
|
|
|
+ "route" => null,
|
|
|
+ "method" => 4,
|
|
|
+ ]);
|
|
|
+ $authWaybill = \App\Authority::query()->create([
|
|
|
+ "name" => "运输管理",
|
|
|
+ "parent_id" => $auth->id,
|
|
|
+ 'alias_name' => \Faker\Provider\Uuid::uuid(),
|
|
|
+ "permission" => "允许",
|
|
|
+ "route" => null,
|
|
|
+ "method" => 4,
|
|
|
+ ]);
|
|
|
+ $authWaybillDispatch = \App\Authority::query()->create([
|
|
|
+ "name" => "调度",
|
|
|
+ "parent_id" => $authWaybill->id,
|
|
|
+ 'alias_name' => \Faker\Provider\Uuid::uuid(),
|
|
|
+ "permission" => "允许",
|
|
|
+ "route" => null,
|
|
|
+ "method" => 4,
|
|
|
+ ]);
|
|
|
+ \App\Authority::query()->insert([
|
|
|
+ [
|
|
|
+ "name" => "查看",
|
|
|
+ "parent_id" => $authWaybillDispatch->id,
|
|
|
+ 'alias_name' => \Faker\Provider\Uuid::uuid(),
|
|
|
+ "permission" => "允许",
|
|
|
+ "route" => "waybill/dispatch",
|
|
|
+ "method" => 0,
|
|
|
+ ],
|
|
|
+ [
|
|
|
+ "name" => "编辑",
|
|
|
+ "parent_id" => $authWaybillDispatch->id,
|
|
|
+ 'alias_name' => \Faker\Provider\Uuid::uuid(),
|
|
|
+ "permission" => "允许",
|
|
|
+ "route" => "waybill/dispatch",
|
|
|
+ "method" => 1,
|
|
|
+ ],[
|
|
|
+ "name" => "专线费",
|
|
|
+ "parent_id" => $authWaybillDispatch->id,
|
|
|
+ 'alias_name' => \Faker\Provider\Uuid::uuid(),
|
|
|
+ "permission" => "允许",
|
|
|
+ "route" => "waybill/dispatch/dailyBilling",
|
|
|
+ "method" => 1,
|
|
|
+ ]
|
|
|
+ ]);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * Reverse the migrations.
|
|
|
+ *
|
|
|
+ * @return void
|
|
|
+ */
|
|
|
+ public function down()
|
|
|
+ {
|
|
|
+ Schema::table('authorities', function (Blueprint $table) {
|
|
|
+ $table->dropIndex("auth_method_index");
|
|
|
+ });
|
|
|
+ }
|
|
|
+}
|