Skip to content

Commit

Permalink
feat: Refactor CompanyLinksHelper to improve role synchronization
Browse files Browse the repository at this point in the history
  • Loading branch information
zerossB committed Jun 18, 2024
1 parent 177575a commit c3d75dd
Showing 1 changed file with 0 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -48,22 +48,9 @@ private function userCompaniesCreateOrUpdate(stdClass $message): void

private function createOrUpdateRoles($userCompanyModel, $roles)
{
Log::info('Roles Uuid: ', [
'roles' => $roles,
'userCompanyModel' => $userCompanyModel->uuid,
'model_roles' => $userCompanyModel->roles->pluck('uuid')->toArray(),
]);

$roleClass = config('permission.models.role');
$rolesModels = $roleClass::whereIn('uuid', $roles)->get(['id'])->pluck('id')->toArray();
$userCompanyModel->syncRoles($rolesModels);

$userCompanyModel->refresh();
Log::info('Roles: ', [
'roles' => $rolesModels,
'userCompanyModel' => $userCompanyModel->uuid,
'model_roles' => $userCompanyModel->roles->pluck('uuid')->toArray(),
]);
}

private function userCompaniesDelete(stdClass $message): void
Expand Down

0 comments on commit c3d75dd

Please sign in to comment.