Skip to content

Commit

Permalink
[Docs] Fix syntax in docs for UUID migration changes
Browse files Browse the repository at this point in the history
  • Loading branch information
drbyte committed Apr 18, 2024
1 parent a229ad5 commit 1890d8b
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions docs/advanced-usage/uuid.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,40 +40,40 @@ If you also want the roles and permissions to use a UUID for their `id` value, t
});

Schema::create($tableNames['model_has_permissions'], function (Blueprint $table) use ($tableNames, $columnNames) {
- $table->unsignedBigInteger(PermissionRegistrar::$pivotPermission);
+ $table->uuid(PermissionRegistrar::$pivotPermission);
- $table->unsignedBigInteger($pivotPermission);
+ $table->uuid($pivotPermission);
$table->string('model_type');
//...
$table->foreign(PermissionRegistrar::$pivotPermission)
$table->foreign($pivotPermission)
- ->references('id') // permission id
+ ->references('uuid') // permission id
->on($tableNames['permissions'])
->onDelete('cascade');
//...

Schema::create($tableNames['model_has_roles'], function (Blueprint $table) use ($tableNames, $columnNames) {
- $table->unsignedBigInteger(PermissionRegistrar::$pivotRole);
+ $table->uuid(PermissionRegistrar::$pivotRole);
- $table->unsignedBigInteger($pivotRole);
+ $table->uuid($pivotRole);
//...
$table->foreign(PermissionRegistrar::$pivotRole)
$table->foreign($pivotRole)
- ->references('id') // role id
+ ->references('uuid') // role id
->on($tableNames['roles'])
->onDelete('cascade');//...

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

$table->foreign(PermissionRegistrar::$pivotPermission)
$table->foreign($pivotPermission)
- ->references('id') // permission id
+ ->references('uuid') // permission id
->on($tableNames['permissions'])
->onDelete('cascade');

$table->foreign(PermissionRegistrar::$pivotRole)
$table->foreign($pivotRole)
- ->references('id') // role id
+ ->references('uuid') // role id
->on($tableNames['roles'])
Expand Down

0 comments on commit 1890d8b

Please sign in to comment.