| @@ 7-37 (lines=31) @@ | ||
| 4 | use Illuminate\Database\Schema\Blueprint; |
|
| 5 | use Illuminate\Database\Migrations\Migration; |
|
| 6 | ||
| 7 | class CreatePermissionRoleTable extends Migration |
|
| 8 | { |
|
| 9 | /** |
|
| 10 | * Run the migrations. |
|
| 11 | * |
|
| 12 | * @return void |
|
| 13 | */ |
|
| 14 | public function up() |
|
| 15 | { |
|
| 16 | if (config('multi-tentant.use_role_and_permissions')) { |
|
| 17 | Schema::create('multi_tenant_permission_multi_tenant_role', function (Blueprint $table) { |
|
| 18 | $table->increments('id'); |
|
| 19 | $table->integer('multi_tenant_role_id')->index()->unsigned(); |
|
| 20 | $table->integer('multi_tenant_permission_id')->index()->unsigned(); |
|
| 21 | $table->timestamps(); |
|
| 22 | }); |
|
| 23 | } |
|
| 24 | } |
|
| 25 | ||
| 26 | /** |
|
| 27 | * Reverse the migrations. |
|
| 28 | * |
|
| 29 | * @return void |
|
| 30 | */ |
|
| 31 | public function down() |
|
| 32 | { |
|
| 33 | if (config('multi-tentant.use_role_and_permissions')) { |
|
| 34 | Schema::dropIfExists('multi_tenant_permission_multi_tenant_role'); |
|
| 35 | } |
|
| 36 | } |
|
| 37 | } |
|
| 38 | ||
| @@ 7-37 (lines=31) @@ | ||
| 4 | use Illuminate\Database\Schema\Blueprint; |
|
| 5 | use Illuminate\Database\Migrations\Migration; |
|
| 6 | ||
| 7 | class CreatePermissionsTable extends Migration |
|
| 8 | { |
|
| 9 | /** |
|
| 10 | * Run the migrations. |
|
| 11 | * |
|
| 12 | * @return void |
|
| 13 | */ |
|
| 14 | public function up() |
|
| 15 | { |
|
| 16 | if (config('multi-tentant.use_role_and_permissions')) { |
|
| 17 | Schema::create('multi_tenant_permission', function (Blueprint $table) { |
|
| 18 | $table->increments('id'); |
|
| 19 | $table->string('name'); |
|
| 20 | $table->string('label')->nullable(); |
|
| 21 | $table->timestamps(); |
|
| 22 | }); |
|
| 23 | } |
|
| 24 | } |
|
| 25 | ||
| 26 | /** |
|
| 27 | * Reverse the migrations. |
|
| 28 | * |
|
| 29 | * @return void |
|
| 30 | */ |
|
| 31 | public function down() |
|
| 32 | { |
|
| 33 | if (config('multi-tentant.use_role_and_permissions')) { |
|
| 34 | Schema::dropIfExists('multi_tenant_permission'); |
|
| 35 | } |
|
| 36 | } |
|
| 37 | } |
|
| 38 | ||
| @@ 7-37 (lines=31) @@ | ||
| 4 | use Illuminate\Database\Schema\Blueprint; |
|
| 5 | use Illuminate\Database\Migrations\Migration; |
|
| 6 | ||
| 7 | class CreateRoleUserTable extends Migration |
|
| 8 | { |
|
| 9 | /** |
|
| 10 | * Run the migrations. |
|
| 11 | * |
|
| 12 | * @return void |
|
| 13 | */ |
|
| 14 | public function up() |
|
| 15 | { |
|
| 16 | if (config('multi-tentant.use_role_and_permissions')) { |
|
| 17 | Schema::create('multi_tenant_role_user', function (Blueprint $table) { |
|
| 18 | $table->increments('id'); |
|
| 19 | $table->integer('multi_tenant_role_id')->index()->unsigned(); |
|
| 20 | $table->integer('user_id')->index()->unsigned(); |
|
| 21 | $table->timestamps(); |
|
| 22 | }); |
|
| 23 | } |
|
| 24 | } |
|
| 25 | ||
| 26 | /** |
|
| 27 | * Reverse the migrations. |
|
| 28 | * |
|
| 29 | * @return void |
|
| 30 | */ |
|
| 31 | public function down() |
|
| 32 | { |
|
| 33 | if (config('multi-tentant.use_role_and_permissions')) { |
|
| 34 | Schema::dropIfExists('multi_tenant_role_user'); |
|
| 35 | } |
|
| 36 | } |
|
| 37 | } |
|
| 38 | ||
| @@ 7-37 (lines=31) @@ | ||
| 4 | use Illuminate\Database\Schema\Blueprint; |
|
| 5 | use Illuminate\Database\Migrations\Migration; |
|
| 6 | ||
| 7 | class CreateRolesTable extends Migration |
|
| 8 | { |
|
| 9 | /** |
|
| 10 | * Run the migrations. |
|
| 11 | * |
|
| 12 | * @return void |
|
| 13 | */ |
|
| 14 | public function up() |
|
| 15 | { |
|
| 16 | if (config('multi-tentant.use_role_and_permissions')) { |
|
| 17 | Schema::create('multi_tenant_roles', function (Blueprint $table) { |
|
| 18 | $table->increments('id'); |
|
| 19 | $table->string('name'); |
|
| 20 | $table->string('label')->nullable(); |
|
| 21 | $table->timestamps(); |
|
| 22 | }); |
|
| 23 | } |
|
| 24 | } |
|
| 25 | ||
| 26 | /** |
|
| 27 | * Reverse the migrations. |
|
| 28 | * |
|
| 29 | * @return void |
|
| 30 | */ |
|
| 31 | public function down() |
|
| 32 | { |
|
| 33 | if (config('multi-tentant.use_role_and_permissions')) { |
|
| 34 | Schema::dropIfExists('multi_tenant_roles'); |
|
| 35 | } |
|
| 36 | } |
|
| 37 | } |
|
| 38 | ||