Completed
Push — master ( d0a6e2...c1e6c3 )
by Stephen
07:22
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
@@ -94,14 +94,17 @@
 block discarded – undo
94 94
      */
95 95
     protected function getALevel($level)
96 96
     {
97
-        if (is_string($level))
98
-            $level = config('laravel-acl.level', Level::class)::whereName($level)->first();
97
+        if (is_string($level)) {
98
+                    $level = config('laravel-acl.level', Level::class)::whereName($level)->first();
99
+        }
99 100
 
100
-        if (is_int($level))
101
-            $level = config('laravel-acl.level', Level::class)::find($level);
101
+        if (is_int($level)) {
102
+                    $level = config('laravel-acl.level', Level::class)::find($level);
103
+        }
102 104
 
103
-        if (!$level)
104
-            throw new LevelNotFoundException();
105
+        if (!$level) {
106
+                    throw new LevelNotFoundException();
107
+        }
105 108
 
106 109
         return $level;
107 110
     }
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
@@ -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.