mirror of
https://github.com/archtechx/tenancy.git
synced 2025-12-12 22:14:03 +00:00
Fix #25 better error handling
This commit is contained in:
parent
fa5334f83e
commit
d2ec7f171d
2 changed files with 15 additions and 2 deletions
|
|
@ -147,9 +147,15 @@ class TenantManager
|
|||
*/
|
||||
public function findByDomain(string $domain = null, $fields = [])
|
||||
{
|
||||
$domain = $domain ?: $this->currentDomain();
|
||||
$domain = $domain ? : $this->currentDomain();
|
||||
|
||||
return $this->find($this->getIdByDomain($domain), $fields);
|
||||
$uuid = $this->getIdByDomain($domain);
|
||||
|
||||
if (is_null($uuid)) {
|
||||
throw new \Exception("Tenant with domain $domain could not be identified.");
|
||||
}
|
||||
|
||||
return $this->find($uuid, $fields);
|
||||
}
|
||||
|
||||
public static function currentDomain(): ?string
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue