Completed
Push — master ( d0a6e2...c1e6c3 )
by Stephen
07:22
created
src/z1haze/Acl/Traits/UserAndLevel.php 1 patch
Spacing   +11 added lines, -13 removed lines patch added patch discarded remove patch
@@ -122,7 +122,7 @@  discard block
 block discarded – undo
122 122
         return Cache::remember(
123 123
             'laravel-acl.getPermissionsFor' . (new ReflectionClass($this))->getShortName() . '_' . $this->id,
124 124
             config('laravel-acl.cacheMinutes'),
125
-            function () {
125
+            function() {
126 126
                 return $this->cachegetPermissions();
127 127
             }
128 128
         );
@@ -142,7 +142,7 @@  discard block
 block discarded – undo
142 142
         return Cache::remember(
143 143
             'laravel-acl.getAllPermissionsFor' . (new ReflectionClass($this))->getShortName() . '_' . $this->id,
144 144
             config('laravel-acl.cacheMinutes'),
145
-            function () {
145
+            function() {
146 146
                 return $this->cacheGetAllPermissions();
147 147
             }
148 148
         );
@@ -162,7 +162,7 @@  discard block
 block discarded – undo
162 162
         return Cache::remember(
163 163
             'laravel-acl.getInheritedPermissionsFor' . (new ReflectionClass($this))->getShortName() . '_' . $this->id,
164 164
             config('laravel-acl.cacheMinutes'),
165
-            function () {
165
+            function() {
166 166
                 return $this->cacheGetInheritedPermissions();
167 167
             }
168 168
         );
@@ -182,7 +182,7 @@  discard block
 block discarded – undo
182 182
         return Cache::remember(
183 183
             'laravel-acl.getAvailablePermissionsFor' . (new ReflectionClass($this))->getShortName() . '_' . $this->id,
184 184
             config('laravel-acl.cacheMinutes'),
185
-            function () {
185
+            function() {
186 186
                 return $this->cacheGetAvailablePermissions();
187 187
             }
188 188
         );
@@ -203,7 +203,7 @@  discard block
 block discarded – undo
203 203
         return Cache::remember(
204 204
             'laravel-acl.hasPermissionTo_' . (new ReflectionClass($this))->getShortName() . '_' . $this->id . '_Permission_' . $permission,
205 205
             config('laravel-acl.cacheMinutes'),
206
-            function () use ($permission) {
206
+            function() use ($permission) {
207 207
                 return $this->cacheHasPermissionTo($permission);
208 208
             }
209 209
         );
@@ -281,7 +281,7 @@  discard block
 block discarded – undo
281 281
 
282 282
         $allPerms = new Collection();
283 283
 
284
-        $levels->each(function ($level, $key) use (&$allPerms) {
284
+        $levels->each(function($level, $key) use (&$allPerms) {
285 285
             $allPerms = $allPerms->merge($level->permissions);
286 286
         });
287 287
 
@@ -300,12 +300,11 @@  discard block
 block discarded – undo
300 300
         $rank = is_a($this, config('laravel-acl.level'), true) ? $this->rank : $this->level->rank;
301 301
 
302 302
         $levels = is_a($this, config('laravel-acl.user'), true) ?
303
-            config('laravel-acl.level', Level::class)::where('rank', '>=', $rank)->with('permissions')->get() :
304
-            config('laravel-acl.level', Level::class)::where('rank', '>', $rank)->with('permissions')->get();
303
+            config('laravel-acl.level', Level::class)::where('rank', '>=', $rank)->with('permissions')->get() : config('laravel-acl.level', Level::class)::where('rank', '>', $rank)->with('permissions')->get();
305 304
 
306 305
         $inheritedPerms = new Collection();
307 306
 
308
-        $levels->each(function ($level, $key) use (&$inheritedPerms) {
307
+        $levels->each(function($level, $key) use (&$inheritedPerms) {
309 308
             $inheritedPerms = $inheritedPerms->merge($level->permissions->load('level'));
310 309
         });
311 310
 
@@ -399,8 +398,7 @@  discard block
 block discarded – undo
399 398
                 $permissionsObjects[$permission->id] = ['negated' => true];
400 399
             } else {
401 400
                 is_a($this, config('laravel-acl.user')) ?
402
-                    array_push($permissionsObjects, $permission->id) :
403
-                    array_push($permissionsObjects, $permission);
401
+                    array_push($permissionsObjects, $permission->id) : array_push($permissionsObjects, $permission);
404 402
             }
405 403
         }
406 404
 
@@ -434,7 +432,7 @@  discard block
 block discarded – undo
434 432
             $this->permissions()->detach($permissionObjects);
435 433
 
436 434
         if (is_a($this, config('laravel-acl.level'))) {
437
-            config('laravel-acl.permission', Permission::class)::whereIn('id', array_map(function ($permission) {
435
+            config('laravel-acl.permission', Permission::class)::whereIn('id', array_map(function($permission) {
438 436
                 return $permission->id;
439 437
             }, $permissionObjects))->update(['level_id' => null]);
440 438
         }
@@ -454,7 +452,7 @@  discard block
 block discarded – undo
454 452
         if (is_a($this, config('laravel-acl.level'))) {
455 453
             $this->clearPermissions();
456 454
 
457
-            config('laravel-acl.permission', Permission::class)::whereIn('id', array_map(function ($permission) {
455
+            config('laravel-acl.permission', Permission::class)::whereIn('id', array_map(function($permission) {
458 456
                 return $permission->id;
459 457
             }, $permissionObjects))
460 458
                 ->update(['level_id' => $this->id]);
Please login to merge, or discard this patch.