Skip to content

Commit

Permalink
remove pivot id
Browse files Browse the repository at this point in the history
  • Loading branch information
fzldn committed Sep 17, 2024
1 parent 53f42b7 commit e423003
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 18 deletions.
7 changes: 0 additions & 7 deletions app/Models/PermissionRole.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,6 @@ class PermissionRole extends Pivot
{
use LogsModel;

/**
* Indicates if the IDs are auto-incrementing.
*
* @var bool
*/
public $incrementing = true;

/**
* Get the table associated with the model.
*
Expand Down
7 changes: 0 additions & 7 deletions app/Models/RoleUser.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,6 @@ class RoleUser extends MorphPivot
{
use LogsModel;

/**
* Indicates if the IDs are auto-incrementing.
*
* @var bool
*/
public $incrementing = true;

/**
* Get the table associated with the model.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,6 @@ public function up(): void
});

Schema::create($tableNames['model_has_roles'], function (Blueprint $table) use ($tableNames, $columnNames, $pivotRole, $teams) {
$table->bigIncrements('id');
$table->unsignedBigInteger($pivotRole);

$table->string('model_type');
Expand All @@ -95,13 +94,12 @@ public function up(): void
$table->primary([$columnNames['team_foreign_key'], $pivotRole, $columnNames['model_morph_key'], 'model_type'],
'model_has_roles_role_model_type_primary');
} else {
$table->unique([$pivotRole, $columnNames['model_morph_key'], 'model_type'],
$table->primary([$pivotRole, $columnNames['model_morph_key'], 'model_type'],
'model_has_roles_role_model_type_primary');
}
});

Schema::create($tableNames['role_has_permissions'], function (Blueprint $table) use ($tableNames, $pivotRole, $pivotPermission) {
$table->bigIncrements('id');
$table->unsignedBigInteger($pivotPermission);
$table->unsignedBigInteger($pivotRole);

Expand All @@ -115,7 +113,7 @@ public function up(): void
->on($tableNames['roles'])
->onDelete('cascade');

$table->unique([$pivotPermission, $pivotRole], 'role_has_permissions_permission_id_role_id_primary');
$table->primary([$pivotPermission, $pivotRole], 'role_has_permissions_permission_id_role_id_primary');
});

app('cache')
Expand Down

0 comments on commit e423003

Please sign in to comment.