Conditions | 1 |
Paths | 1 |
Total Lines | 21 |
Code Lines | 14 |
Lines | 0 |
Ratio | 0 % |
Changes | 2 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
14 | public function up() |
||
15 | { |
||
16 | Schema::create('role_user', function (Blueprint $table) { |
||
17 | $pkMethod = config('rakshak.users.pk_type', 'uuid'); |
||
18 | // dd('pkMethod: ' . $pkMethod); |
||
19 | |||
20 | $table->{$pkMethod}('user_id'); |
||
21 | $table->uuid('role_id'); |
||
22 | $table->timestamps(); |
||
23 | |||
24 | $table->foreign('user_id') |
||
25 | ->references('id') |
||
26 | ->on('users') |
||
27 | ->onDelete('cascade'); |
||
28 | |||
29 | $table->foreign('role_id') |
||
30 | ->references('id') |
||
31 | ->on('roles') |
||
32 | ->onDelete('cascade'); |
||
33 | |||
34 | $table->primary(['user_id', 'role_id']); |
||
35 | }); |
||
48 |