diff --git a/README.md b/README.md index c5f5d5e4..10dade5f 100644 --- a/README.md +++ b/README.md @@ -133,7 +133,7 @@ Read the [Storage driver](#storage-driver) section for more information. ## Obtaining a `TenantManager` instance -You can use the `tenancy()` and `tenant()` helpers to resolve `Stancl\Tenancy\TenantManager` out of the service container. These two helpers are exactly the same, the only reason there are two is nice syntax. `tenancy()->init()` sounds better than `tenant()->init()` and `tenant()->create()` sounds better than `tenancy()->create()`. +You can use the `tenancy()` and `tenant()` helpers to resolve `Stancl\Tenancy\TenantManager` out of the service container. These two helpers are exactly the same, the only reason there are two is nice syntax. `tenancy()->init()` sounds better than `tenant()->init()` and `tenant()->create()` sounds better than `tenancy()->create()`. **You may also use the `Tenancy` facade.** ### Creating a new tenant diff --git a/composer.json b/composer.json index 1c7a1f1e..748b1b24 100644 --- a/composer.json +++ b/composer.json @@ -37,7 +37,10 @@ "laravel": { "providers": [ "Stancl\\Tenancy\\TenancyServiceProvider" - ] + ], + "aliases": { + "Tenancy": "Stancl\\Tenancy\\TenancyFacade" + } } } } diff --git a/src/TenancyFacade.php b/src/TenancyFacade.php new file mode 100644 index 00000000..a3c4acdc --- /dev/null +++ b/src/TenancyFacade.php @@ -0,0 +1,13 @@ +put('foo', 'bar'); + Tenancy::put('abc', 'xyz'); + + $this->assertSame('bar', Tenancy::get('foo')); + $this->assertSame('xyz', Tenancy::get('abc')); + } +}