| Conditions | 2 |
| Paths | 2 |
| Total Lines | 17 |
| Code Lines | 14 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 14 | public function up() |
||
| 15 | { |
||
| 16 | $connection = config('roles.connection'); |
||
| 17 | $table = config('roles.permissionsRoleTable'); |
||
| 18 | $permissionsTable = config('roles.permissionsTable'); |
||
| 19 | $rolesTable = config('roles.rolesTable'); |
||
| 20 | $tableCheck = Schema::connection($connection)->hasTable($table); |
||
| 21 | |||
| 22 | if (!$tableCheck) { |
||
| 23 | Schema::connection($connection)->create($table, function (Blueprint $table) use ($permissionsTable, $rolesTable) { |
||
| 24 | $table->increments('id')->unsigned(); |
||
| 25 | $table->integer('permission_id')->unsigned()->index(); |
||
| 26 | $table->foreign('permission_id')->references('id')->on($permissionsTable)->onDelete('cascade'); |
||
| 27 | $table->integer('role_id')->unsigned()->index(); |
||
| 28 | $table->foreign('role_id')->references('id')->on($rolesTable)->onDelete('cascade'); |
||
| 29 | $table->timestamps(); |
||
| 30 | $table->softDeletes(); |
||
| 31 | }); |
||
| 47 |