Skip to content

Commit

Permalink
Activate ngo admin in all institution centers
Browse files Browse the repository at this point in the history
  • Loading branch information
alexPopaCode4 committed Dec 24, 2024
1 parent 91a0c27 commit 0d19a92
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions app/Models/User.php
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,18 @@ public function hasRoleInOrganization(Role | int $role): bool

public function activate(): void
{
if ($this->isNgoAdmin()) {
$this->organizations
->filter(fn (Organization $organization) => $organization->id !== Filament::getTenant()?->id)
->each(
fn (Organization $organization) => UserStatus::query()
->withoutGlobalScopes([BelongsToCurrentTenant::class])
->where('organization_id', $organization->id)
->where('user_id', $this->id)
->first()
?->activate()
);
}
$this->userStatus->activate();
}

Expand Down

0 comments on commit 0d19a92

Please sign in to comment.