@@ -31,8 +31,8 @@ discard block |
||
| 31 | 31 | return $ret; |
| 32 | 32 | } |
| 33 | 33 | |
| 34 | - private function getGraphData($start_id, $nest = 1){ |
|
| 35 | - if($this->nest >= $nest){ |
|
| 34 | + private function getGraphData($start_id, $nest = 1) { |
|
| 35 | + if ($this->nest >= $nest) { |
|
| 36 | 36 | $nest++; |
| 37 | 37 | // get unions first |
| 38 | 38 | $person = Person::find($start_id); |
@@ -44,7 +44,7 @@ discard block |
||
| 44 | 44 | |
| 45 | 45 | |
| 46 | 46 | // add children |
| 47 | - foreach($families as $family) { |
|
| 47 | + foreach ($families as $family) { |
|
| 48 | 48 | $family_id = $family->id; |
| 49 | 49 | |
| 50 | 50 | $father = Person::find($family->husband_id); |
@@ -52,13 +52,13 @@ discard block |
||
| 52 | 52 | // add partner to person |
| 53 | 53 | // add partner link |
| 54 | 54 | |
| 55 | - if(isset($father->id)){ |
|
| 55 | + if (isset($father->id)) { |
|
| 56 | 56 | $_families = Family::where('husband_id', $father->id)->orwhere('wife_id', $father->id)->select('id')->get()->toArray(); |
| 57 | 57 | $father->setAttribute('own_unions', $_families); |
| 58 | 58 | $this->persons[$father->id] = $father; |
| 59 | 59 | $this->links[] = [$father->id, $family_id]; |
| 60 | 60 | } |
| 61 | - if(isset($mother->id)){ |
|
| 61 | + if (isset($mother->id)) { |
|
| 62 | 62 | $_families = Family::where('husband_id', $mother->id)->orwhere('wife_id', $mother->id)->select('id')->get()->toArray(); |
| 63 | 63 | $mother->setAttribute('own_unions', $_families); |
| 64 | 64 | $this->persons[$mother->id] = $mother; |
@@ -70,7 +70,7 @@ discard block |
||
| 70 | 70 | // find children |
| 71 | 71 | $children = Person::where('child_in_family_id', $family_id)->get(); |
| 72 | 72 | $children_ids = []; |
| 73 | - foreach($children as $child){ |
|
| 73 | + foreach ($children as $child) { |
|
| 74 | 74 | $child_id = $child->id; |
| 75 | 75 | // add child to person |
| 76 | 76 | // parent_union |
@@ -84,13 +84,13 @@ discard block |
||
| 84 | 84 | |
| 85 | 85 | // make union child filds |
| 86 | 86 | $children_ids[] = $child_id; |
| 87 | - $this->getGraphData($child_id,$nest); |
|
| 87 | + $this->getGraphData($child_id, $nest); |
|
| 88 | 88 | } |
| 89 | 89 | |
| 90 | 90 | // compose union item and add to unions |
| 91 | 91 | $union = array(); |
| 92 | 92 | $union['id'] = $family_id; |
| 93 | - $union['partner'] = [isset($father->id) ? $father->id : null, isset($mother->id)? $mother->id: null]; |
|
| 93 | + $union['partner'] = [isset($father->id) ? $father->id : null, isset($mother->id) ? $mother->id : null]; |
|
| 94 | 94 | $union['children'] = $children_ids; |
| 95 | 95 | $this->unions[$family_id] = $union; |
| 96 | 96 | $own_unions[] = $family_id; |