Total Complexity | 6 |
Total Lines | 43 |
Duplicated Lines | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 1 |
1 | <?php |
||
8 | class TenantManager |
||
9 | { |
||
10 | /* |
||
11 | * @var null|App\Models\Tenant |
||
|
|||
12 | */ |
||
13 | private $tenant; |
||
14 | |||
15 | public function setTenant(?Tenant $tenant) |
||
16 | { |
||
17 | $this->tenant = $tenant; |
||
18 | |||
19 | return $this; |
||
20 | } |
||
21 | |||
22 | public function getTenant(): ?Tenant |
||
25 | } |
||
26 | |||
27 | public function loadTenant($identifier): bool |
||
28 | { |
||
29 | $tenant = Tenant::query()->where('subdomain', '=', $identifier)->first(); |
||
30 | |||
31 | if ($tenant) { |
||
32 | $this->setTenant($tenant); |
||
33 | |||
34 | return true; |
||
35 | } |
||
36 | |||
37 | return false; |
||
38 | } |
||
39 | |||
40 | public function loadTenantByUsername($username): bool |
||
51 | } |
||
52 | } |
||
53 |