20 lines
436 B
PHP
20 lines
436 B
PHP
<?php
|
|
|
|
namespace Spatie\Permission\Traits;
|
|
|
|
use Spatie\Permission\PermissionRegistrar;
|
|
|
|
trait RefreshesPermissionCache
|
|
{
|
|
public static function bootRefreshesPermissionCache()
|
|
{
|
|
static::saved(function () {
|
|
app(PermissionRegistrar::class)->forgetCachedPermissions();
|
|
});
|
|
|
|
static::deleted(function () {
|
|
app(PermissionRegistrar::class)->forgetCachedPermissions();
|
|
});
|
|
}
|
|
}
|