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