Skip to content

Commit

Permalink
Merge pull request #453 from code4romania/222-activate-ngo-admin-in-a…
Browse files Browse the repository at this point in the history
…ll-centers

activate ngo admin in all centers
  • Loading branch information
gheorghelupu17 authored Dec 27, 2024
2 parents 8661397 + 18c0b8f commit 4341cad
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions app/Models/User.php
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,21 @@ 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 &&
$organization->institution_id === $this->institution_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 4341cad

Please sign in to comment.