Skip to content

Commit d939b43

Browse files
committed
user_type from user_roles is now included in the PK.
1 parent 7eded2c commit d939b43

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

database/migrations/2022_09_15_175019_create_user_roles_table.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ public function up(): void
1717
$table->timestamps();
1818
$table->softDeletes();
1919

20-
$table->primary(['user_id', 'role_id']);
20+
$table->primary(['user_type', 'user_id', 'role_id']);
2121
});
2222
}
2323

src/Models/UserRole.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ class UserRole extends Model
2525
*/
2626
protected $primaryKey = [
2727
'role_id',
28+
'user_type',
2829
'user_id'
2930
];
3031

0 commit comments

Comments
 (0)