Skip to content

Commit

Permalink
Fix default config parameters when user may not be authenticated
Browse files Browse the repository at this point in the history
  • Loading branch information
cbaconnier committed Jan 10, 2022
1 parent 5fc4295 commit f40a98e
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions src/Repositories/DatabaseConfigRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,17 +38,17 @@ public function region(): string

public function scopes(): array
{
return $this->get()['parameters']['scopes'];
return $this->get()['parameters']['scopes'] ?? [];
}

public function secret(): string
{
return $this->get()['secrets']['secret'];
return $this->get()['secrets']['secret'] ?? '';
}

public function clientId(): string
{
return $this->get()['secrets']['client_id'];
return $this->get()['secrets']['client_id'] ?? '';
}

public function currentOrganizationId(): string|null
Expand Down Expand Up @@ -84,15 +84,15 @@ public function delete(): void
]);
}

protected function ownerId(): int|string
protected function ownerId(): int|string|null
{
return Auth::guard(config('zoho.auth_guard'))->id();
return Auth::guard(config('zoho.auth_guard'))?->id();
}

protected function ownerType(): string
protected function ownerType(): string|null
{
/** @var Model $user */
$user = Auth::guard(config('zoho.auth_guard'))->user();
return $user->getMorphClass();
return $user?->getMorphClass();
}
}

0 comments on commit f40a98e

Please sign in to comment.