Skip to content

Commit

Permalink
Update 2023_01_20_000000_create_roles_permissions_table.php
Browse files Browse the repository at this point in the history
  • Loading branch information
hsbmaulana authored Nov 26, 2023
1 parent 53fa596 commit 319304c
Showing 1 changed file with 2 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -139,19 +139,8 @@ public function up()

Schema::create($tableNames["role_has_permissions"], function (Blueprint $table) use ($keytype, $tableNames) {

if ($keytype == "int") {

$table->unsignedBigInteger(PermissionRegistrar::$pivotPermission);
$table->unsignedBigInteger(PermissionRegistrar::$pivotRole);

} else if ($keytype == "string") {

$table->uuid(PermissionRegistrar::$pivotPermission);
$table->uuid(PermissionRegistrar::$pivotRole);
}

$table->foreign(PermissionRegistrar::$pivotPermission, "acl_role_has_permissions_permission_id_foreign")->references("id")->on($tableNames["permissions"])->onUpdate("cascade")->onDelete("cascade");
$table->foreign(PermissionRegistrar::$pivotRole, "acl_role_has_permissions_role_id_foreign")->references("id")->on($tableNames["roles"])->onUpdate("cascade")->onDelete("cascade");
$table->foreignUuid(PermissionRegistrar::$pivotPermission, "acl_role_has_permissions_permission_id_foreign")->references("id")->on($tableNames["permissions"])->onUpdate("cascade")->onDelete("cascade");
$table->foreignUuid(PermissionRegistrar::$pivotRole, "acl_role_has_permissions_role_id_foreign")->references("id")->on($tableNames["roles"])->onUpdate("cascade")->onDelete("cascade");

$table->primary([ PermissionRegistrar::$pivotPermission, PermissionRegistrar::$pivotRole, ], "role_has_permissions_permission_id_role_id_primary");
});
Expand Down

0 comments on commit 319304c

Please sign in to comment.