mirror of
https://github.com/stancl/tenancy-docs.git
synced 2025-12-12 18:24:03 +00:00
Update spatie.blade.md
$cacheKey has become static
This commit is contained in:
parent
d6233d0df2
commit
06ab596048
1 changed files with 4 additions and 10 deletions
|
|
@ -34,15 +34,13 @@ Next, add the following listeners to the `TenancyBootstrapped` and `TenancyEnde
|
||||||
```php
|
```php
|
||||||
Events\TenancyBootstrapped::class => [
|
Events\TenancyBootstrapped::class => [
|
||||||
function (Events\TenancyBootstrapped $event) {
|
function (Events\TenancyBootstrapped $event) {
|
||||||
$permissionRegistrar = app(\Spatie\Permission\PermissionRegistrar::class);
|
\Spatie\Permission\PermissionRegistrar::$cacheKey = 'spatie.permission.cache.tenant.' . $event->tenancy->tenant->getTenantKey();
|
||||||
$permissionRegistrar->cacheKey = 'spatie.permission.cache.tenant.' . $event->tenancy->tenant->getTenantKey();
|
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
|
||||||
Events\TenancyEnded::class => [
|
Events\TenancyEnded::class => [
|
||||||
function (Events\TenancyEnded $event) {
|
function (Events\TenancyEnded $event) {
|
||||||
$permissionRegistrar = app(\Spatie\Permission\PermissionRegistrar::class);
|
\Spatie\Permission\PermissionRegistrar::$cacheKey = 'spatie.permission.cache';
|
||||||
$permissionRegistrar->cacheKey = 'spatie.permission.cache';
|
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
```
|
```
|
||||||
|
|
@ -52,18 +50,14 @@ Alternatively, create a bootstrapper:
|
||||||
```php
|
```php
|
||||||
class SpatiePermissionsBootstrapper implements TenancyBootstrapper
|
class SpatiePermissionsBootstrapper implements TenancyBootstrapper
|
||||||
{
|
{
|
||||||
public function __construct(
|
|
||||||
protected PermissionRegistrar $registrar,
|
|
||||||
) {}
|
|
||||||
|
|
||||||
public function bootstrap(Tenant $tenant): void
|
public function bootstrap(Tenant $tenant): void
|
||||||
{
|
{
|
||||||
$this->registrar->cacheKey = 'spatie.permission.cache.tenant.' . $tenant->getTenantKey();
|
\Spatie\Permission\PermissionRegistrar::$cacheKey = 'spatie.permission.cache.tenant.' . $tenant->getTenantKey();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function revert(): void
|
public function revert(): void
|
||||||
{
|
{
|
||||||
$this->registrar->cacheKey = 'spatie.permission.cache';
|
\Spatie\Permission\PermissionRegistrar::$cacheKey = 'spatie.permission.cache';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue