Completed
Pull Request — 5.4 (#4)
by
unknown
03:23
created
src/Traits/HasRoleAndPermission.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -44,10 +44,10 @@
 block discarded – undo
44 44
      */
45 45
     public function getRoles()
46 46
     {
47
-        if(!$this->roles){
47
+        if (!$this->roles) {
48 48
             $this->roles = $this->roles()->get();
49 49
 
50
-            foreach($this->roles as $role)
50
+            foreach ($this->roles as $role)
51 51
                     $this->roles = $this->roles->merge($role->descendants());
52 52
         }
53 53
         return  $this->roles;
Please login to merge, or discard this patch.
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -47,8 +47,9 @@
 block discarded – undo
47 47
         if(!$this->roles){
48 48
             $this->roles = $this->roles()->get();
49 49
 
50
-            foreach($this->roles as $role)
51
-                    $this->roles = $this->roles->merge($role->descendants());
50
+            foreach($this->roles as $role) {
51
+                                $this->roles = $this->roles->merge($role->descendants());
52
+            }
52 53
         }
53 54
         return  $this->roles;
54 55
     }
Please login to merge, or discard this patch.
src/Traits/RoleHasRelations.php 2 patches
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -35,7 +35,7 @@  discard block
 block discarded – undo
35 35
      */
36 36
     public function parent()
37 37
     {
38
-        return $this->belongsTo(config('roles.models.role'),'parent_id');
38
+        return $this->belongsTo(config('roles.models.role'), 'parent_id');
39 39
     }
40 40
 
41 41
     public function ancestors()
@@ -56,13 +56,13 @@  discard block
 block discarded – undo
56 56
      */
57 57
     public function children()
58 58
     {
59
-        return $this->hasMany(config('roles.models.role'),'parent_id');
59
+        return $this->hasMany(config('roles.models.role'), 'parent_id');
60 60
     }
61 61
 
62 62
     public function descendants()
63 63
     {
64 64
         $descendants = $this->where('parent_id', '=', $this->id)->get();
65
-        foreach($descendants as $descendant)
65
+        foreach ($descendants as $descendant)
66 66
             $descendants = $descendants->merge($descendant->descendants());
67 67
         return $descendants;
68 68
     }
Please login to merge, or discard this patch.
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -62,8 +62,9 @@
 block discarded – undo
62 62
     public function descendants()
63 63
     {
64 64
         $descendants = $this->where('parent_id', '=', $this->id)->get();
65
-        foreach($descendants as $descendant)
66
-            $descendants = $descendants->merge($descendant->descendants());
65
+        foreach($descendants as $descendant) {
66
+                    $descendants = $descendants->merge($descendant->descendants());
67
+        }
67 68
         return $descendants;
68 69
     }
69 70
 
Please login to merge, or discard this patch.