Completed
Push — master ( 9db00f...f6d536 )
by Stephen
34:21
created
src/z1haze/Acl/Models/Permission.php 1 patch
Braces   +6 added lines, -4 removed lines patch added patch discarded remove patch
@@ -99,11 +99,13 @@
 block discarded – undo
99 99
      */
100 100
     protected function getUser($user)
101 101
     {
102
-        if (is_int($user))
103
-            $user = config('laravel-acl.user')::find($user);
102
+        if (is_int($user)) {
103
+                    $user = config('laravel-acl.user')::find($user);
104
+        }
104 105
 
105
-        if (!$user)
106
-            throw new UserNotFoundException;
106
+        if (!$user) {
107
+                    throw new UserNotFoundException;
108
+        }
107 109
 
108 110
         return $user;
109 111
     }
Please login to merge, or discard this patch.
src/z1haze/Acl/Traits/UserAndPermission.php 1 patch
Braces   +9 added lines, -6 removed lines patch added patch discarded remove patch
@@ -59,14 +59,17 @@
 block discarded – undo
59 59
      */
60 60
     protected function getLevel($level)
61 61
     {
62
-        if (is_string($level))
63
-            $level = config('laravel-acl.level', Level::class)::whereName($level)->first();
62
+        if (is_string($level)) {
63
+                    $level = config('laravel-acl.level', Level::class)::whereName($level)->first();
64
+        }
64 65
 
65
-        if (is_int($level))
66
-            $level = config('laravel-acl.level', Level::class)::find($level);
66
+        if (is_int($level)) {
67
+                    $level = config('laravel-acl.level', Level::class)::find($level);
68
+        }
67 69
 
68
-        if (!$level)
69
-            throw new LevelNotFoundException();
70
+        if (!$level) {
71
+                    throw new LevelNotFoundException();
72
+        }
70 73
 
71 74
         return $level;
72 75
     }
Please login to merge, or discard this patch.
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.