Skip to content

Commit

Permalink
[Fix] detach not working before save
Browse files Browse the repository at this point in the history
  • Loading branch information
kiritokatklian authored Nov 15, 2023
2 parents afc1250 + 09b02f6 commit d2c8a5b
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/RoleBooleanGroup.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ protected function fillAttributeFromRequest(NovaRequest $request, $requestAttrib
return;
}

$model->roles()->detach();
$model->syncRoles([]);

collect(json_decode($request[$requestAttribute], true))
->filter(static function (bool $value) {
Expand Down
2 changes: 1 addition & 1 deletion src/RoleSelect.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ protected function fillAttributeFromRequest(NovaRequest $request, $requestAttrib
return;
}

$model->roles()->detach();
$model->syncRoles([]);

if (! is_null($request[$requestAttribute])) {
$roleClass = app(PermissionRegistrar::class)->getRoleClass();
Expand Down

0 comments on commit d2c8a5b

Please sign in to comment.