1
0
Fork 0
mirror of https://github.com/archtechx/tenancy.git synced 2025-12-12 11:34:03 +00:00

Identification middleware & tests

This commit is contained in:
Samuel Štancl 2020-05-10 05:47:27 +02:00
parent a17727b437
commit 8ea4940f34
18 changed files with 362 additions and 174 deletions

View file

@ -3,7 +3,7 @@
namespace Stancl\Tenancy;
use Stancl\Tenancy\Contracts\TenancyBootstrapper;
use Stancl\Tenancy\Database\Models\Tenant;
use Stancl\Tenancy\Database\Models\Tenant; // todo contract
class Tenancy
{
@ -18,6 +18,11 @@ class Tenancy
public function initialize(Tenant $tenant): void
{
// todo the id is something that should be on the contract, with a method
if ($this->initialized && $this->tenant->id === $tenant->id) {
return;
}
$this->tenant = $tenant;
$this->initialized = true;