| @@ 179-190 (lines=12) @@ | ||
| 176 | * @param $permission |
|
| 177 | * @return bool |
|
| 178 | */ |
|
| 179 | public function hasPermissionTo($permission) |
|
| 180 | { |
|
| 181 | $shortName = (new ReflectionClass($this))->getShortName(); |
|
| 182 | ||
| 183 | return Cache::remember( |
|
| 184 | 'laravel-acl.hasPermissionTo_' . $shortName . '_' . $this->id . '_Permission_' . $permission, |
|
| 185 | config('laravel-acl.cacheMinutes'), |
|
| 186 | function() use ($permission) { |
|
| 187 | return $this->cacheHasPermissionTo($permission); |
|
| 188 | } |
|
| 189 | ); |
|
| 190 | } |
|
| 191 | ||
| 192 | /** |
|
| 193 | * USER & LEVEL |
|
| @@ 243-254 (lines=12) @@ | ||
| 240 | * @param $type |
|
| 241 | * @return \Illuminate\Support\Collection |
|
| 242 | */ |
|
| 243 | protected function cachePull($type) |
|
| 244 | { |
|
| 245 | $shortName = (new ReflectionClass($this))->getShortName(); |
|
| 246 | ||
| 247 | return Cache::remember( |
|
| 248 | 'laravel-acl.' . lcfirst(substr($type, 5)) . 'For' . $shortName . '_' . $this->id, |
|
| 249 | config('laravel-acl.cacheMinutes'), |
|
| 250 | function() use ($type) { |
|
| 251 | return $this->{$type}(); |
|
| 252 | } |
|
| 253 | ); |
|
| 254 | } |
|
| 255 | /** |
|
| 256 | * USER & LEVEL |
|
| 257 | * Return a collection of permissions |
|