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

Add methods to Tenant contract

This commit is contained in:
Samuel Štancl 2020-05-10 20:20:44 +02:00
parent 494d274798
commit 2492345280
3 changed files with 18 additions and 7 deletions

View file

@ -3,7 +3,7 @@
namespace Stancl\Tenancy;
use Stancl\Tenancy\Contracts\TenancyBootstrapper;
use Stancl\Tenancy\Database\Models\Tenant; // todo contract
use Stancl\Tenancy\Contracts\Tenant;
class Tenancy
{
@ -18,8 +18,7 @@ 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) {
if ($this->initialized && $this->tenant->getTenantKey() === $tenant->getTenantKey()) {
return;
}
@ -42,6 +41,7 @@ class Tenancy
/** @return TenancyBootstrapper[] */
public function getBootstrappers(): array
{
// If no callback for getting bootstrappers is set, we just return all of them.
$resolve = static::$getBootstrappers ?? function (Tenant $tenant) {
return config('tenancy.bootstrappers');
};