20 lines
448 B
PHP
20 lines
448 B
PHP
<?php
|
|
|
|
namespace App\Models\Permission\Traits;
|
|
|
|
use App\Domains\Permission\Services\PermissionService;
|
|
|
|
trait RefreshesPermissionCache
|
|
{
|
|
public static function bootRefreshesPermissionCache()
|
|
{
|
|
static::saved(function () {
|
|
app(PermissionService::class)->forgetCachedPermissions();
|
|
});
|
|
|
|
static::deleted(function () {
|
|
app(PermissionService::class)->forgetCachedPermissions();
|
|
});
|
|
}
|
|
}
|