1
0
Fork 0
mirror of https://github.com/archtechx/tenancy.git synced 2025-12-13 09:04:04 +00:00

Go back to public constructor

This commit is contained in:
Samuel Štancl 2019-09-15 09:28:36 +02:00
parent e69a8f597f
commit 8bb13c7159

View file

@ -5,7 +5,6 @@ declare(strict_types=1);
namespace Stancl\Tenancy; namespace Stancl\Tenancy;
use ArrayAccess; use ArrayAccess;
use Illuminate\Foundation\Application;
use Stancl\Tenancy\Contracts\StorageDriver; use Stancl\Tenancy\Contracts\StorageDriver;
use Stancl\Tenancy\Contracts\UniqueIdentifierGenerator; use Stancl\Tenancy\Contracts\UniqueIdentifierGenerator;
@ -46,16 +45,16 @@ class Tenant implements ArrayAccess
*/ */
protected $persisted = false; protected $persisted = false;
protected function __construct(Application $app) public function __construct(StorageDriver $storage, TenantManager $tenantManager, UniqueIdentifierGenerator $idGenerator)
{ {
$this->storage = $app[StorageDriver::class]; $this->storage = $storage;
$this->manager = $app[TenantManager::class]; $this->manager = $tenantManager;
$this->idGenerator = $app[UniqueIdentifierGenerator::class]; $this->idGenerator = $idGenerator;
} }
public static function new(Application $app = null): self public static function new(): self
{ {
return new static($app ?? app()); return app(static::class);
} }
public static function fromStorage(array $data): self public static function fromStorage(array $data): self