Initial PHP rebuild of the app
This commit is contained in:
690 files changed
+33944
-12046
No files matched your search
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
namespace App\Services\Tenant;
|
||||
|
||||
use App\Models\Business;
|
||||
|
||||
final class TenantContext
|
||||
{
|
||||
private ?Business $business = null;
|
||||
|
||||
public function set(Business $business): void
|
||||
{
|
||||
$this->business = $business;
|
||||
}
|
||||
|
||||
public function business(): ?Business
|
||||
{
|
||||
return $this->business;
|
||||
}
|
||||
|
||||
public function id(): ?string
|
||||
{
|
||||
return $this->business?->getKey();
|
||||
}
|
||||
|
||||
public function require(): Business
|
||||
{
|
||||
abort_unless($this->business, 404, 'Business not found.');
|
||||
|
||||
return $this->business;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user