1
0
Fork 0
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:
Samuel Štancl 2019-02-13 16:26:00 +01:00
parent fa5334f83e
commit d2ec7f171d
2 changed files with 15 additions and 2 deletions

View file

@ -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