| @@ 6-32 (lines=27) @@ | ||
| 3 | use Illuminate\Database\Migrations\Migration; |
|
| 4 | use Illuminate\Database\Schema\Blueprint; |
|
| 5 | ||
| 6 | class CreatePermissionRoleTable extends Migration |
|
| 7 | { |
|
| 8 | /** |
|
| 9 | * Run the migrations. |
|
| 10 | * |
|
| 11 | * @return void |
|
| 12 | */ |
|
| 13 | public function up() |
|
| 14 | { |
|
| 15 | Schema::create('permission_role', function (Blueprint $table) { |
|
| 16 | $table->id(); |
|
| 17 | $table->foreignId('permission_id')->constrained()->cascadeOnDelete(); |
|
| 18 | $table->foreignId('role_id')->constrained()->cascadeOnDelete(); |
|
| 19 | $table->timestamps(); |
|
| 20 | }); |
|
| 21 | } |
|
| 22 | ||
| 23 | /** |
|
| 24 | * Reverse the migration. |
|
| 25 | * |
|
| 26 | * @return void |
|
| 27 | */ |
|
| 28 | public function down() |
|
| 29 | { |
|
| 30 | Schema::drop('permission_role'); |
|
| 31 | } |
|
| 32 | } |
|
| 33 | ||
| @@ 6-32 (lines=27) @@ | ||
| 3 | use Illuminate\Database\Migrations\Migration; |
|
| 4 | use Illuminate\Database\Schema\Blueprint; |
|
| 5 | ||
| 6 | class CreateRoleUserTable extends Migration |
|
| 7 | { |
|
| 8 | /** |
|
| 9 | * Run the migrations. |
|
| 10 | * |
|
| 11 | * @return void |
|
| 12 | */ |
|
| 13 | public function up() |
|
| 14 | { |
|
| 15 | Schema::create('role_user', function (Blueprint $table) { |
|
| 16 | $table->id('id'); |
|
| 17 | $table->foreignId('role_id')->constrained()->cascadeOnDelete(); |
|
| 18 | $table->foreignId('user_id')->constrained()->cascadeOnDelete(); |
|
| 19 | $table->timestamps(); |
|
| 20 | }); |
|
| 21 | } |
|
| 22 | ||
| 23 | /** |
|
| 24 | * Reverse the migration. |
|
| 25 | * |
|
| 26 | * @return void |
|
| 27 | */ |
|
| 28 | public function down() |
|
| 29 | { |
|
| 30 | Schema::drop('role_user'); |
|
| 31 | } |
|
| 32 | } |
|
| 33 | ||
| @@ 7-33 (lines=27) @@ | ||
| 4 | use Illuminate\Database\Schema\Blueprint; |
|
| 5 | use Illuminate\Support\Facades\Schema; |
|
| 6 | ||
| 7 | class CreatePermissionUserTable extends Migration |
|
| 8 | { |
|
| 9 | /** |
|
| 10 | * Run the migrations. |
|
| 11 | * |
|
| 12 | * @return void |
|
| 13 | */ |
|
| 14 | public function up() |
|
| 15 | { |
|
| 16 | Schema::create('permission_user', function (Blueprint $table) { |
|
| 17 | $table->id(); |
|
| 18 | $table->foreignId('permission_id')->constrained()->cascadeOnDelete(); |
|
| 19 | $table->foreignId('user_id')->constrained()->cascadeOnDelete(); |
|
| 20 | $table->timestamps(); |
|
| 21 | }); |
|
| 22 | } |
|
| 23 | ||
| 24 | /** |
|
| 25 | * Reverse the migrations. |
|
| 26 | * |
|
| 27 | * @return void |
|
| 28 | */ |
|
| 29 | public function down() |
|
| 30 | { |
|
| 31 | Schema::dropIfExists('permission_user'); |
|
| 32 | } |
|
| 33 | } |
|
| 34 | ||