Completed
Push — master ( 3d9eaa...7212f9 )
by Stephen
35:45
created
src/z1haze/Acl/Traits/UserAndLevel.php 1 patch
Braces   +27 added lines, -18 removed lines patch added patch discarded remove patch
@@ -105,11 +105,13 @@  discard block
 block discarded – undo
105 105
      */
106 106
     public function clearPermissions()
107 107
     {
108
-        if (is_a($this, config('laravel-acl.user'), true))
109
-            $this->permissions()->detach();
108
+        if (is_a($this, config('laravel-acl.user'), true)) {
109
+                    $this->permissions()->detach();
110
+        }
110 111
 
111
-        if (is_a($this, config('laravel-acl.level'), true))
112
-            config('laravel-acl.permission', Permission::class)::whereLevelId($this->id)->update(['level_id' => null]);
112
+        if (is_a($this, config('laravel-acl.level'), true)) {
113
+                    config('laravel-acl.permission', Permission::class)::whereLevelId($this->id)->update(['level_id' => null]);
114
+        }
113 115
     }
114 116
 
115 117
 
@@ -413,11 +415,13 @@  discard block
 block discarded – undo
413 415
      */
414 416
     protected function addOrNegate($model, $permissionObjects, $action)
415 417
     {
416
-        if ($model == 'User')
417
-            $this->permissions()->attach($permissionObjects);
418
+        if ($model == 'User') {
419
+                    $this->permissions()->attach($permissionObjects);
420
+        }
418 421
 
419
-        if ($model == 'Level')
420
-            $this->permissions()->saveMany($permissionObjects);
422
+        if ($model == 'Level') {
423
+                    $this->permissions()->saveMany($permissionObjects);
424
+        }
421 425
     }
422 426
 
423 427
     /**
@@ -429,8 +433,9 @@  discard block
 block discarded – undo
429 433
      */
430 434
     protected function remove($model, $permissionObjects)
431 435
     {
432
-        if ($model == 'User')
433
-            $this->permissions()->detach($permissionObjects);
436
+        if ($model == 'User') {
437
+                    $this->permissions()->detach($permissionObjects);
438
+        }
434 439
 
435 440
         if ($model == 'Level') {
436 441
             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($model, $permissionObjects)
450 455
     {
451
-        if ($model == 'User')
452
-            $this->permissions()->sync($permissionObjects);
456
+        if ($model == 'User') {
457
+                    $this->permissions()->sync($permissionObjects);
458
+        }
453 459
 
454 460
         if ($model == '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.