| @@ 28-44 (lines=17) @@ | ||
| 25 | }); |
|
| 26 | } |
|
| 27 | ||
| 28 | public static function bootEntrustRoleTrait() |
|
| 29 | { |
|
| 30 | static::saved(function ($item) { |
|
| 31 | //Cache::tags(Config::get('entrust.permission_role_table'))->flush(); |
|
| 32 | Cache::forget('entrust_permissions_for_role_' . $item->getKey()); |
|
| 33 | }); |
|
| 34 | static::deleted(function ($item) { |
|
| 35 | //Cache::tags(Config::get('entrust.permission_role_table'))->flush(); |
|
| 36 | Cache::forget('entrust_permissions_for_role_' . $item->getKey()); |
|
| 37 | }); |
|
| 38 | if (method_exists(static::class, 'restored')) { |
|
| 39 | static::restored(function ($item) { |
|
| 40 | //Cache::tags(Config::get('entrust.permission_role_table'))->flush(); |
|
| 41 | Cache::forget('entrust_permissions_for_role_' . $item->getKey()); |
|
| 42 | }); |
|
| 43 | } |
|
| 44 | } |
|
| 45 | ||
| 46 | /** |
|
| 47 | * Many-to-Many relations with the user model. |
|
| @@ 29-45 (lines=17) @@ | ||
| 26 | }); |
|
| 27 | } |
|
| 28 | ||
| 29 | public static function bootEntrustUserTrait() |
|
| 30 | { |
|
| 31 | static::saved(function ($item) { |
|
| 32 | //Cache::tags(Config::get('entrust.role_user_table'))->flush(); |
|
| 33 | Cache::forget('entrust_role_for_user_' . $item->getKey()); |
|
| 34 | }); |
|
| 35 | static::deleted(function ($item) { |
|
| 36 | //Cache::tags(Config::get('entrust.role_user_table'))->flush(); |
|
| 37 | Cache::forget('entrust_role_for_user_' . $item->getKey()); |
|
| 38 | }); |
|
| 39 | if (method_exists(static::class, 'restored')) { |
|
| 40 | static::restored(function ($item) { |
|
| 41 | //Cache::tags(Config::get('entrust.role_user_table'))->flush(); |
|
| 42 | Cache::forget('entrust_role_for_user_' . $item->getKey()); |
|
| 43 | }); |
|
| 44 | } |
|
| 45 | } |
|
| 46 | ||
| 47 | /** |
|
| 48 | * Many-to-Many relations with Role. |
|