Passed
Push — master ( 92bcbd...28ff2f )
by Curtis
06:11
created
app/Family.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -31,11 +31,11 @@
 block discarded – undo
31 31
             ->pluck('individuals.id');
32 32
     }
33 33
 
34
-    public function info(){
35
-        return $this->belongsTo(Individual::class,'father_id','id');
34
+    public function info() {
35
+        return $this->belongsTo(Individual::class, 'father_id', 'id');
36 36
     }
37 37
 
38
-    public function spouse(){
39
-        return $this->hasOne(Individual::class,'id','mother_id');
38
+    public function spouse() {
39
+        return $this->hasOne(Individual::class, 'id', 'mother_id');
40 40
     }
41 41
 }
Please login to merge, or discard this patch.
app/Http/Controllers/Tree/TreeController.php 2 patches
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -26,9 +26,9 @@  discard block
 block discarded – undo
26 26
      */
27 27
     public function pedigree($father_id = 1)
28 28
     {
29
-        $father = Family::with(['info','spouse'])->where('type_id','>=',1)->where('father_id',$father_id)->first();
29
+        $father = Family::with(['info', 'spouse'])->where('type_id', '>=', 1)->where('father_id', $father_id)->first();
30 30
         $data = [];
31
-        if($father){
31
+        if ($father) {
32 32
             $data[] = array(
33 33
                 'name' => $father->info->getNameAttribute(),
34 34
                 'class' => 'node',
@@ -38,7 +38,7 @@  discard block
 block discarded – undo
38 38
                     ['spouse' => array(
39 39
                         'name' => $father->spouse->getNameAttribute()
40 40
                     ),
41
-                        'children' => $father->info->children->map(function ($item) {
41
+                        'children' => $father->info->children->map(function($item) {
42 42
                             return ['name' => $item['first_name'].' '.$item['last_name']];
43 43
                         })->all()],
44 44
 
@@ -59,12 +59,12 @@  discard block
 block discarded – undo
59 59
      * @param  integer $nest      [Set how many nested children]
60 60
      * @return Array | Json
61 61
      */
62
-    public function show($parent_id = 1, $nest = 1){
62
+    public function show($parent_id = 1, $nest = 1) {
63 63
         $this->nest = 1; // initialize nesting to 1
64 64
 
65 65
         $parents = Individual::where('is_active', 1)->where('id', $parent_id)->get();
66 66
 
67
-        $tree = $this->getChildren($parents, (int)$nest);
67
+        $tree = $this->getChildren($parents, (int) $nest);
68 68
 
69 69
         return $tree;
70 70
     }
@@ -79,24 +79,24 @@  discard block
 block discarded – undo
79 79
      * @param  boolean $show    [description]
80 80
      * @return array           [description]
81 81
      */
82
-    public function getChildren($parents = 1, $nest = 1, $show = true){
82
+    public function getChildren($parents = 1, $nest = 1, $show = true) {
83 83
         $data = [];
84
-        if($this->nest <= $nest){
84
+        if ($this->nest <= $nest) {
85 85
             $this->nest++;
86 86
 
87
-            foreach($parents as $key => $parent)
87
+            foreach ($parents as $key => $parent)
88 88
             {
89
-                if($show === true){
89
+                if ($show === true) {
90 90
                     $data[] = [
91 91
                         'id' => $parent->id,
92 92
                         'text' => $parent->getNameAttribute(),
93
-                        'children' => $this->getChildren($parent->children,$nest,$show)
93
+                        'children' => $this->getChildren($parent->children, $nest, $show)
94 94
                     ];
95
-                }else{
95
+                } else {
96 96
                     $data[] = [
97 97
                         'id' => $parent->id,
98 98
                         'name' => $parent->getNameAttribute(),
99
-                        'children' => $this->getChildren($parent->children,$nest,$show)
99
+                        'children' => $this->getChildren($parent->children, $nest, $show)
100 100
                     ];
101 101
                 }
102 102
 
@@ -114,12 +114,12 @@  discard block
 block discarded – undo
114 114
      * @param  integer $nest      [Set how many nested children]
115 115
      * @return Array | Json
116 116
      */
117
-    public function edge($parent_id = 1, $nest = 1){
117
+    public function edge($parent_id = 1, $nest = 1) {
118 118
         $this->nest = 1; // initialize nesting to 1
119 119
 
120 120
         $parents = Individual::where('is_active', 1)->where('id', $parent_id)->get();
121 121
 
122
-        $tree = $this->getChildren($parents, (int)$nest, false);
122
+        $tree = $this->getChildren($parents, (int) $nest, false);
123 123
 
124 124
         return $tree;
125 125
     }
Please login to merge, or discard this patch.
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -92,7 +92,7 @@
 block discarded – undo
92 92
                         'text' => $parent->getNameAttribute(),
93 93
                         'children' => $this->getChildren($parent->children,$nest,$show)
94 94
                     ];
95
-                }else{
95
+                } else{
96 96
                     $data[] = [
97 97
                         'id' => $parent->id,
98 98
                         'name' => $parent->getNameAttribute(),
Please login to merge, or discard this patch.