Completed
Push — master ( d0a6e2...c1e6c3 )
by Stephen
07:22
created
src/z1haze/Acl/Traits/UserAndLevel.php 2 patches
Unused Use Statements   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -3,9 +3,9 @@
 block discarded – undo
3 3
 namespace z1haze\Acl\Traits;
4 4
 
5 5
 use Illuminate\Support\Collection;
6
+use Illuminate\Support\Facades\Cache;
6 7
 use ReflectionClass;
7 8
 use z1haze\Acl\Exceptions\PermissionNotFoundException;
8
-use Illuminate\Support\Facades\Cache;
9 9
 use z1haze\Acl\Models\Level;
10 10
 use z1haze\Acl\Models\Permission;
11 11
 
Please login to merge, or discard this patch.
Braces   +27 added lines, -18 removed lines patch added patch discarded remove patch
@@ -101,11 +101,13 @@  discard block
 block discarded – undo
101 101
      */
102 102
     public function clearPermissions()
103 103
     {
104
-        if (is_a($this, config('laravel-acl.user'), true))
105
-            $this->permissions()->detach();
104
+        if (is_a($this, config('laravel-acl.user'), true)) {
105
+                    $this->permissions()->detach();
106
+        }
106 107
 
107
-        if (is_a($this, config('laravel-acl.level'), true))
108
-            config('laravel-acl.permission', Permission::class)::whereLevelId($this->id)->update(['level_id' => null]);
108
+        if (is_a($this, config('laravel-acl.level'), true)) {
109
+                    config('laravel-acl.permission', Permission::class)::whereLevelId($this->id)->update(['level_id' => null]);
110
+        }
109 111
     }
110 112
 
111 113
     /**
@@ -415,11 +417,13 @@  discard block
 block discarded – undo
415 417
      */
416 418
     protected function addOrNegate($permissionObjects)
417 419
     {
418
-        if (is_a($this, config('laravel-acl.user')))
419
-            $this->permissions()->attach($permissionObjects);
420
+        if (is_a($this, config('laravel-acl.user'))) {
421
+                    $this->permissions()->attach($permissionObjects);
422
+        }
420 423
 
421
-        if (is_a($this, config('laravel-acl.level')))
422
-            $this->permissions()->saveMany($permissionObjects);
424
+        if (is_a($this, config('laravel-acl.level'))) {
425
+                    $this->permissions()->saveMany($permissionObjects);
426
+        }
423 427
     }
424 428
 
425 429
     /**
@@ -430,8 +434,9 @@  discard block
 block discarded – undo
430 434
      */
431 435
     protected function remove($permissionObjects)
432 436
     {
433
-        if (is_a($this, config('laravel-acl.user')))
434
-            $this->permissions()->detach($permissionObjects);
437
+        if (is_a($this, config('laravel-acl.user'))) {
438
+                    $this->permissions()->detach($permissionObjects);
439
+        }
435 440
 
436 441
         if (is_a($this, config('laravel-acl.level'))) {
437 442
             config('laravel-acl.permission', Permission::class)::whereIn('id', array_map(function ($permission) {
@@ -448,8 +453,9 @@  discard block
 block discarded – undo
448 453
      */
449 454
     protected function sync($permissionObjects)
450 455
     {
451
-        if (is_a($this, config('laravel-acl.user')))
452
-            $this->permissions()->sync($permissionObjects);
456
+        if (is_a($this, config('laravel-acl.user'))) {
457
+                    $this->permissions()->sync($permissionObjects);
458
+        }
453 459
 
454 460
         if (is_a($this, config('laravel-acl.level'))) {
455 461
             $this->clearPermissions();
@@ -472,14 +478,17 @@  discard block
 block discarded – undo
472 478
      */
473 479
     protected function getPermission($permission)
474 480
     {
475
-        if (is_string($permission))
476
-            $permission = config('laravel-acl.permission', Permission::class)::whereName($permission)->first();
481
+        if (is_string($permission)) {
482
+                    $permission = config('laravel-acl.permission', Permission::class)::whereName($permission)->first();
483
+        }
477 484
 
478
-        if (is_int($permission))
479
-            $permission = config('laravel-acl.permission', Permission::class)::find($permission);
485
+        if (is_int($permission)) {
486
+                    $permission = config('laravel-acl.permission', Permission::class)::find($permission);
487
+        }
480 488
 
481
-        if (!$permission)
482
-            throw new PermissionNotFoundException;
489
+        if (!$permission) {
490
+                    throw new PermissionNotFoundException;
491
+        }
483 492
 
484 493
         return $permission;
485 494
     }
Please login to merge, or discard this patch.