mirror of
https://github.com/stancl/tenancy-docs.git
synced 2025-12-12 10:14: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
|
||||
Events\TenancyBootstrapped::class => [
|
||||
function (Events\TenancyBootstrapped $event) {
|
||||
$permissionRegistrar = app(\Spatie\Permission\PermissionRegistrar::class);
|
||||
$permissionRegistrar->cacheKey = 'spatie.permission.cache.tenant.' . $event->tenancy->tenant->getTenantKey();
|
||||
\Spatie\Permission\PermissionRegistrar::$cacheKey = 'spatie.permission.cache.tenant.' . $event->tenancy->tenant->getTenantKey();
|
||||
}
|
||||
],
|
||||
|
||||
Events\TenancyEnded::class => [
|
||||
function (Events\TenancyEnded $event) {
|
||||
$permissionRegistrar = app(\Spatie\Permission\PermissionRegistrar::class);
|
||||
$permissionRegistrar->cacheKey = 'spatie.permission.cache';
|
||||
\Spatie\Permission\PermissionRegistrar::$cacheKey = 'spatie.permission.cache';
|
||||
}
|
||||
],
|
||||
```
|
||||
|
|
@ -52,18 +50,14 @@ Alternatively, create a bootstrapper:
|
|||
```php
|
||||
class SpatiePermissionsBootstrapper implements TenancyBootstrapper
|
||||
{
|
||||
public function __construct(
|
||||
protected PermissionRegistrar $registrar,
|
||||
) {}
|
||||
|
||||
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
|
||||
{
|
||||
$this->registrar->cacheKey = 'spatie.permission.cache';
|
||||
\Spatie\Permission\PermissionRegistrar::$cacheKey = 'spatie.permission.cache';
|
||||
}
|
||||
}
|
||||
```
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue