@@ -25,7 +25,7 @@ discard block |
||
| 25 | 25 | $familiesjoined = Family::all()->count(); |
| 26 | 26 | $peoplesattached = Person::all()->count(); |
| 27 | 27 | $chart = array($male, $female, $unknown); |
| 28 | - return ['chart' => $chart,'familiesjoined' => $familiesjoined,'peoplesattached' => $peoplesattached]; |
|
| 28 | + return ['chart' => $chart, 'familiesjoined' => $familiesjoined, 'peoplesattached' => $peoplesattached]; |
|
| 29 | 29 | } |
| 30 | 30 | |
| 31 | 31 | /** |
@@ -37,7 +37,7 @@ discard block |
||
| 37 | 37 | { |
| 38 | 38 | $user = auth()->user(); |
| 39 | 39 | $company = $user->Company(); |
| 40 | - $trees =Tree::where('company_id',$company->id)->get(); |
|
| 40 | + $trees = Tree::where('company_id', $company->id)->get(); |
|
| 41 | 41 | return $trees; |
| 42 | 42 | } |
| 43 | 43 | |
@@ -48,7 +48,7 @@ discard block |
||
| 48 | 48 | } |
| 49 | 49 | |
| 50 | 50 | public function getTree() { |
| 51 | - $trees =Tree::where('company_id',request('company_id'))->get(); |
|
| 51 | + $trees = Tree::where('company_id', request('company_id'))->get(); |
|
| 52 | 52 | return $trees; |
| 53 | 53 | } |
| 54 | 54 | public function changedb(Request $request) |
@@ -130,7 +130,7 @@ discard block |
||
| 130 | 130 | public function trial() |
| 131 | 131 | { |
| 132 | 132 | $user = auth()->user(); |
| 133 | - if($user->subscribed('default')) { |
|
| 133 | + if ($user->subscribed('default')) { |
|
| 134 | 134 | $days = Carbon::now()->diffInDays(Carbon::parse($user->subscription('default')->asStripeSubscription()->current_period_end)); |
| 135 | 135 | } else { |
| 136 | 136 | $days = Carbon::now()->diffInDays($user->trial_ends_at); |
@@ -16,34 +16,34 @@ discard block |
||
| 16 | 16 | { |
| 17 | 17 | $query = PersonAsso::query(); |
| 18 | 18 | |
| 19 | - if($request->has('searchTerm')) { |
|
| 20 | - $columnsToSearch = ['group','indi','rela','import_confirm']; |
|
| 19 | + if ($request->has('searchTerm')) { |
|
| 20 | + $columnsToSearch = ['group', 'indi', 'rela', 'import_confirm']; |
|
| 21 | 21 | $search_term = json_decode($request->searchTerm)->searchTerm; |
| 22 | - if(!empty($search_term)) { |
|
| 22 | + if (!empty($search_term)) { |
|
| 23 | 23 | $searchQuery = '%' . $search_term . '%'; |
| 24 | - foreach($columnsToSearch as $column) { |
|
| 24 | + foreach ($columnsToSearch as $column) { |
|
| 25 | 25 | $query->orWhere($column, 'LIKE', $searchQuery); |
| 26 | 26 | } |
| 27 | 27 | } |
| 28 | 28 | } |
| 29 | 29 | |
| 30 | - if($request->has('columnFilters')) { |
|
| 30 | + if ($request->has('columnFilters')) { |
|
| 31 | 31 | |
| 32 | 32 | $filters = get_object_vars(json_decode($request->columnFilters)); |
| 33 | 33 | |
| 34 | - foreach($filters as $key => $value) { |
|
| 35 | - if(!empty($value)) { |
|
| 34 | + foreach ($filters as $key => $value) { |
|
| 35 | + if (!empty($value)) { |
|
| 36 | 36 | $query->orWhere($key, 'like', '%' . $value . '%'); |
| 37 | 37 | } |
| 38 | 38 | } |
| 39 | 39 | } |
| 40 | 40 | |
| 41 | - if($request->has('sort.0')) { |
|
| 41 | + if ($request->has('sort.0')) { |
|
| 42 | 42 | $sort = json_decode($request->sort[0]); |
| 43 | 43 | $query->orderBy($sort->field, $sort->type); |
| 44 | 44 | } |
| 45 | 45 | |
| 46 | - if($request->has("perPage")) { |
|
| 46 | + if ($request->has("perPage")) { |
|
| 47 | 47 | $rows = $query->paginate($request->perPage); |
| 48 | 48 | } |
| 49 | 49 | |
@@ -135,7 +135,7 @@ discard block |
||
| 135 | 135 | public function destroy($id) |
| 136 | 136 | { |
| 137 | 137 | $personasso = PersonAsso::find($id); |
| 138 | - if($personasso) { |
|
| 138 | + if ($personasso) { |
|
| 139 | 139 | $personasso->delete(); |
| 140 | 140 | return "true"; |
| 141 | 141 | } |
@@ -18,36 +18,36 @@ discard block |
||
| 18 | 18 | */ |
| 19 | 19 | public function index(Request $request) |
| 20 | 20 | { |
| 21 | - $query = FamilyEvent::query()->with(['family','place']); |
|
| 21 | + $query = FamilyEvent::query()->with(['family', 'place']); |
|
| 22 | 22 | |
| 23 | - if($request->has('searchTerm')) { |
|
| 24 | - $columnsToSearch = ['family_id','places_id','date','title','description','year','month','day','type','plac','phon','caus','age','agnc','husb','wife','converted_date','addr_id']; |
|
| 23 | + if ($request->has('searchTerm')) { |
|
| 24 | + $columnsToSearch = ['family_id', 'places_id', 'date', 'title', 'description', 'year', 'month', 'day', 'type', 'plac', 'phon', 'caus', 'age', 'agnc', 'husb', 'wife', 'converted_date', 'addr_id']; |
|
| 25 | 25 | $search_term = json_decode($request->searchTerm)->searchTerm; |
| 26 | - if(!empty($search_term)) { |
|
| 26 | + if (!empty($search_term)) { |
|
| 27 | 27 | $searchQuery = '%' . $search_term . '%'; |
| 28 | - foreach($columnsToSearch as $column) { |
|
| 28 | + foreach ($columnsToSearch as $column) { |
|
| 29 | 29 | $query->orWhere($column, 'LIKE', $searchQuery); |
| 30 | 30 | } |
| 31 | 31 | } |
| 32 | 32 | } |
| 33 | 33 | |
| 34 | - if($request->has('columnFilters')) { |
|
| 34 | + if ($request->has('columnFilters')) { |
|
| 35 | 35 | |
| 36 | 36 | $filters = get_object_vars(json_decode($request->columnFilters)); |
| 37 | 37 | |
| 38 | - foreach($filters as $key => $value) { |
|
| 39 | - if(!empty($value)) { |
|
| 38 | + foreach ($filters as $key => $value) { |
|
| 39 | + if (!empty($value)) { |
|
| 40 | 40 | $query->orWhere($key, 'like', '%' . $value . '%'); |
| 41 | 41 | } |
| 42 | 42 | } |
| 43 | 43 | } |
| 44 | 44 | |
| 45 | - if($request->has('sort.0')) { |
|
| 45 | + if ($request->has('sort.0')) { |
|
| 46 | 46 | $sort = json_decode($request->sort[0]); |
| 47 | 47 | $query->orderBy($sort->field, $sort->type); |
| 48 | 48 | } |
| 49 | 49 | |
| 50 | - if($request->has("perPage")) { |
|
| 50 | + if ($request->has("perPage")) { |
|
| 51 | 51 | $rows = $query->paginate($request->perPage); |
| 52 | 52 | } |
| 53 | 53 | |
@@ -207,7 +207,7 @@ discard block |
||
| 207 | 207 | public function destroy($id) |
| 208 | 208 | { |
| 209 | 209 | $familyevent = FamilyEvent::find($id); |
| 210 | - if($familyevent) { |
|
| 210 | + if ($familyevent) { |
|
| 211 | 211 | $familyevent->delete(); |
| 212 | 212 | return "true"; |
| 213 | 213 | } |
@@ -16,34 +16,34 @@ discard block |
||
| 16 | 16 | { |
| 17 | 17 | $query = Addr::query(); |
| 18 | 18 | |
| 19 | - if($request->has('searchTerm')) { |
|
| 20 | - $columnsToSearch = ['adr1','adr2','city','stae','post','ctry']; |
|
| 19 | + if ($request->has('searchTerm')) { |
|
| 20 | + $columnsToSearch = ['adr1', 'adr2', 'city', 'stae', 'post', 'ctry']; |
|
| 21 | 21 | $search_term = json_decode($request->searchTerm)->searchTerm; |
| 22 | - if(!empty($search_term)) { |
|
| 22 | + if (!empty($search_term)) { |
|
| 23 | 23 | $searchQuery = '%' . $search_term . '%'; |
| 24 | - foreach($columnsToSearch as $column) { |
|
| 24 | + foreach ($columnsToSearch as $column) { |
|
| 25 | 25 | $query->orWhere($column, 'LIKE', $searchQuery); |
| 26 | 26 | } |
| 27 | 27 | } |
| 28 | 28 | } |
| 29 | 29 | |
| 30 | - if($request->has('columnFilters')) { |
|
| 30 | + if ($request->has('columnFilters')) { |
|
| 31 | 31 | |
| 32 | 32 | $filters = get_object_vars(json_decode($request->columnFilters)); |
| 33 | 33 | |
| 34 | - foreach($filters as $key => $value) { |
|
| 35 | - if(!empty($value)) { |
|
| 34 | + foreach ($filters as $key => $value) { |
|
| 35 | + if (!empty($value)) { |
|
| 36 | 36 | $query->orWhere($key, 'like', '%' . $value . '%'); |
| 37 | 37 | } |
| 38 | 38 | } |
| 39 | 39 | } |
| 40 | 40 | |
| 41 | - if($request->has('sort.0')) { |
|
| 41 | + if ($request->has('sort.0')) { |
|
| 42 | 42 | $sort = json_decode($request->sort[0]); |
| 43 | 43 | $query->orderBy($sort->field, $sort->type); |
| 44 | 44 | } |
| 45 | 45 | |
| 46 | - if($request->has("perPage")) { |
|
| 46 | + if ($request->has("perPage")) { |
|
| 47 | 47 | $rows = $query->paginate($request->perPage); |
| 48 | 48 | } |
| 49 | 49 | |
@@ -142,7 +142,7 @@ discard block |
||
| 142 | 142 | public function destroy($id) |
| 143 | 143 | { |
| 144 | 144 | $addr = Addr::find($id); |
| 145 | - if($addr) { |
|
| 145 | + if ($addr) { |
|
| 146 | 146 | $addr->delete(); |
| 147 | 147 | return "true"; |
| 148 | 148 | } |
@@ -31,41 +31,41 @@ discard block |
||
| 31 | 31 | |
| 32 | 32 | $query = Tree::query()->with('company'); |
| 33 | 33 | |
| 34 | - if($request->has('searchTerm')) { |
|
| 34 | + if ($request->has('searchTerm')) { |
|
| 35 | 35 | $columnsToSearch = ['name']; |
| 36 | 36 | $search_term = json_decode($request->searchTerm)->searchTerm; |
| 37 | - if(!empty($search_term)) { |
|
| 37 | + if (!empty($search_term)) { |
|
| 38 | 38 | $searchQuery = '%' . $search_term . '%'; |
| 39 | - foreach($columnsToSearch as $column) { |
|
| 39 | + foreach ($columnsToSearch as $column) { |
|
| 40 | 40 | $query->orWhere($column, 'LIKE', $searchQuery); |
| 41 | 41 | } |
| 42 | 42 | } |
| 43 | 43 | } |
| 44 | 44 | |
| 45 | - if($request->has('columnFilters')) { |
|
| 45 | + if ($request->has('columnFilters')) { |
|
| 46 | 46 | |
| 47 | 47 | $filters = get_object_vars(json_decode($request->columnFilters)); |
| 48 | 48 | |
| 49 | - foreach($filters as $key => $value) { |
|
| 50 | - if(!empty($value)) { |
|
| 49 | + foreach ($filters as $key => $value) { |
|
| 50 | + if (!empty($value)) { |
|
| 51 | 51 | $query->orWhere($key, 'like', '%' . $value . '%'); |
| 52 | 52 | } |
| 53 | 53 | } |
| 54 | 54 | } |
| 55 | 55 | |
| 56 | - $user = auth()->user(); |
|
| 56 | + $user = auth()->user(); |
|
| 57 | 57 | $company = $user->Company()->pluck('companies.id'); |
| 58 | - $query->whereIn('company_id',$company); |
|
| 58 | + $query->whereIn('company_id', $company); |
|
| 59 | 59 | |
| 60 | - if($request->has('sort.0')) { |
|
| 60 | + if ($request->has('sort.0')) { |
|
| 61 | 61 | $sort = json_decode($request->sort[0]); |
| 62 | 62 | $query->orderBy($sort->field, $sort->type); |
| 63 | 63 | } |
| 64 | 64 | |
| 65 | - if($request->has("perPage")) { |
|
| 65 | + if ($request->has("perPage")) { |
|
| 66 | 66 | $rows = $query->paginate($request->perPage); |
| 67 | 67 | } |
| 68 | - if(!count($request->all())) { |
|
| 68 | + if (!count($request->all())) { |
|
| 69 | 69 | $rows = $query->get()->toArray(); |
| 70 | 70 | } |
| 71 | 71 | |
@@ -85,7 +85,7 @@ discard block |
||
| 85 | 85 | $roles = $user->roles; |
| 86 | 86 | $role = $roles[0]->id; |
| 87 | 87 | if ($role == 7 || $role == 8) { |
| 88 | - if(Tree::whereIn('company_id', $companies_id)->count() < 1){ |
|
| 88 | + if (Tree::whereIn('company_id', $companies_id)->count() < 1) { |
|
| 89 | 89 | return response()->json(['create_tree' => true]); |
| 90 | 90 | } else { |
| 91 | 91 | return response()->json(['create_tree' => false]); |
@@ -93,7 +93,7 @@ discard block |
||
| 93 | 93 | } |
| 94 | 94 | |
| 95 | 95 | else if ($role == 5 || $role == 6) { |
| 96 | - if(Tree::whereIn('company_id', $companies_id)->count() < 10){ |
|
| 96 | + if (Tree::whereIn('company_id', $companies_id)->count() < 10) { |
|
| 97 | 97 | return response()->json(['create_tree' => true]); |
| 98 | 98 | } else { |
| 99 | 99 | return response()->json(['create_tree' => false]); |
@@ -129,12 +129,12 @@ discard block |
||
| 129 | 129 | ])->id; |
| 130 | 130 | |
| 131 | 131 | $tenant_id = DB::connection($this->getConnectionName())->table('tenants')->insertGetId([ |
| 132 | - 'name' => 'tenant'.$tree_id, |
|
| 132 | + 'name' => 'tenant' . $tree_id, |
|
| 133 | 133 | 'tree_id' => $tree_id, |
| 134 | - 'database' => 'tenant'.$tree_id |
|
| 134 | + 'database' => 'tenant' . $tree_id |
|
| 135 | 135 | ]); |
| 136 | 136 | |
| 137 | - DB::statement('create database tenant'.$tree_id); |
|
| 137 | + DB::statement('create database tenant' . $tree_id); |
|
| 138 | 138 | |
| 139 | 139 | Artisan::call('tenants:artisan "migrate --database=tenant --force"'); |
| 140 | 140 | } |
@@ -194,11 +194,11 @@ discard block |
||
| 194 | 194 | $_families = Family::on($conn)->where('husband_id', $father->id)->orwhere('wife_id', $father->id)->select('id')->get(); |
| 195 | 195 | $_union_ids = []; |
| 196 | 196 | foreach ($_families as $item) { |
| 197 | - $_union_ids[] = 'u'.$item->id; |
|
| 197 | + $_union_ids[] = 'u' . $item->id; |
|
| 198 | 198 | } |
| 199 | 199 | $father->setAttribute('own_unions', $_union_ids); |
| 200 | 200 | $this->persons[$father->id] = $father; |
| 201 | - $this->links[] = [$father->id, 'u'.$family_id]; |
|
| 201 | + $this->links[] = [$father->id, 'u' . $family_id]; |
|
| 202 | 202 | } |
| 203 | 203 | if (isset($mother->id)) { |
| 204 | 204 | $_families = Family::on($conn)->where('husband_id', $mother->id)->orwhere('wife_id', $mother->id)->select('id')->get(); |
@@ -208,7 +208,7 @@ discard block |
||
| 208 | 208 | } |
| 209 | 209 | $mother->setAttribute('own_unions', $_union_ids); |
| 210 | 210 | $this->persons[$mother->id] = $mother; |
| 211 | - $this->links[] = [$mother->id, 'u'.$family_id]; |
|
| 211 | + $this->links[] = [$mother->id, 'u' . $family_id]; |
|
| 212 | 212 | } |
| 213 | 213 | |
| 214 | 214 | // find children |
@@ -228,7 +228,7 @@ discard block |
||
| 228 | 228 | $this->persons[$child_id] = $child_data; |
| 229 | 229 | |
| 230 | 230 | // add union-child link |
| 231 | - $this->links[] = ['u'.$family_id, $child_id]; |
|
| 231 | + $this->links[] = ['u' . $family_id, $child_id]; |
|
| 232 | 232 | |
| 233 | 233 | // make union child filds |
| 234 | 234 | $children_ids[] = $child_id; |
@@ -237,10 +237,10 @@ discard block |
||
| 237 | 237 | |
| 238 | 238 | // compose union item and add to unions |
| 239 | 239 | $union = []; |
| 240 | - $union['id'] = 'u'.$family_id; |
|
| 240 | + $union['id'] = 'u' . $family_id; |
|
| 241 | 241 | $union['partner'] = [isset($father->id) ? $father->id : null, isset($mother->id) ? $mother->id : null]; |
| 242 | 242 | $union['children'] = $children_ids; |
| 243 | - $this->unions['u'.$family_id] = $union; |
|
| 243 | + $this->unions['u' . $family_id] = $union; |
|
| 244 | 244 | } |
| 245 | 245 | } |
| 246 | 246 | |
@@ -266,27 +266,27 @@ discard block |
||
| 266 | 266 | return; |
| 267 | 267 | } |
| 268 | 268 | // do self |
| 269 | - if (! array_key_exists($start_id, $this->persons)) { |
|
| 269 | + if (!array_key_exists($start_id, $this->persons)) { |
|
| 270 | 270 | // this is not added |
| 271 | 271 | $_families = Family::on($conn)->where('husband_id', $start_id)->orwhere('wife_id', $start_id)->select('id')->get(); |
| 272 | 272 | $_union_ids = []; |
| 273 | 273 | foreach ($_families as $item) { |
| 274 | - $_union_ids[] = 'u'.$item->id; |
|
| 274 | + $_union_ids[] = 'u' . $item->id; |
|
| 275 | 275 | // add current family link |
| 276 | 276 | // $this->links[] = [$start_id, 'u'.$item->id]; |
| 277 | - array_unshift($this->links, [$start_id, 'u'.$item->id]); |
|
| 277 | + array_unshift($this->links, [$start_id, 'u' . $item->id]); |
|
| 278 | 278 | } |
| 279 | 279 | $person->setAttribute('own_unions', $_union_ids); |
| 280 | - $person->setAttribute('parent_union', 'u'.$person->child_in_family_id); |
|
| 280 | + $person->setAttribute('parent_union', 'u' . $person->child_in_family_id); |
|
| 281 | 281 | // add to persons |
| 282 | 282 | $this->persons[$start_id] = $person; |
| 283 | 283 | |
| 284 | 284 | // get self's parents data |
| 285 | 285 | $p_family_id = $person->child_in_family_id; |
| 286 | - if (! empty($p_family_id)) { |
|
| 286 | + if (!empty($p_family_id)) { |
|
| 287 | 287 | // add parent family link |
| 288 | 288 | // $this->links[] = ['u'.$p_family_id, $start_id] ; |
| 289 | - array_unshift($this->links, ['u'.$p_family_id, $start_id]); |
|
| 289 | + array_unshift($this->links, ['u' . $p_family_id, $start_id]); |
|
| 290 | 290 | $p_family = Family::on($conn)->find($p_family_id); |
| 291 | 291 | if (isset($p_family->husband_id)) { |
| 292 | 292 | $p_fatherid = $p_family->husband_id; |
@@ -305,27 +305,27 @@ discard block |
||
| 305 | 305 | $father = Person::on($conn)->find($family->husband_id); |
| 306 | 306 | $mother = Person::on($conn)->find($family->wife_id); |
| 307 | 307 | if (isset($father->id)) { |
| 308 | - if (! array_key_exists($father->id, $this->persons)) { |
|
| 308 | + if (!array_key_exists($father->id, $this->persons)) { |
|
| 309 | 309 | // this is not added |
| 310 | 310 | $_families = Family::on($conn)->where('husband_id', $father->id)->orwhere('wife_id', $father->id)->select('id')->get(); |
| 311 | 311 | $_union_ids = []; |
| 312 | 312 | foreach ($_families as $item) { |
| 313 | - $_union_ids[] = 'u'.$item->id; |
|
| 313 | + $_union_ids[] = 'u' . $item->id; |
|
| 314 | 314 | } |
| 315 | 315 | $father->setAttribute('own_unions', $_union_ids); |
| 316 | - $father->setAttribute('parent_union', 'u'.$father->child_in_family_id); |
|
| 316 | + $father->setAttribute('parent_union', 'u' . $father->child_in_family_id); |
|
| 317 | 317 | // add to persons |
| 318 | 318 | $this->persons[$father->id] = $father; |
| 319 | 319 | |
| 320 | 320 | // add current family link |
| 321 | 321 | // $this->links[] = [$father->id, 'u'.$family_id]; |
| 322 | - array_unshift($this->links, [$father->id, 'u'.$family_id]); |
|
| 322 | + array_unshift($this->links, [$father->id, 'u' . $family_id]); |
|
| 323 | 323 | // get husband's parents data |
| 324 | 324 | $p_family_id = $father->child_in_family_id; |
| 325 | - if (! empty($p_family_id)) { |
|
| 325 | + if (!empty($p_family_id)) { |
|
| 326 | 326 | // add parent family link |
| 327 | 327 | // $this->links[] = ['u'.$p_family_id, $father->id] ; |
| 328 | - array_unshift($this->links, ['u'.$p_family_id, $father->id]); |
|
| 328 | + array_unshift($this->links, ['u' . $p_family_id, $father->id]); |
|
| 329 | 329 | $p_family = Family::on($conn)->find($p_family_id); |
| 330 | 330 | if (isset($p_family->husband_id)) { |
| 331 | 331 | $p_fatherid = $p_family->husband_id; |
@@ -339,7 +339,7 @@ discard block |
||
| 339 | 339 | } |
| 340 | 340 | } |
| 341 | 341 | if (isset($mother->id)) { |
| 342 | - if (! array_key_exists($mother->id, $this->persons)) { |
|
| 342 | + if (!array_key_exists($mother->id, $this->persons)) { |
|
| 343 | 343 | // this is not added |
| 344 | 344 | $_families = Family::on($conn)->where('husband_id', $mother->id)->orwhere('wife_id', $mother->id)->select('id')->get(); |
| 345 | 345 | $_union_ids = []; |
@@ -347,18 +347,18 @@ discard block |
||
| 347 | 347 | $_union_ids[] = $item->id; |
| 348 | 348 | } |
| 349 | 349 | $mother->setAttribute('own_unions', $_union_ids); |
| 350 | - $mother->setAttribute('parent_union', 'u'.$mother->child_in_family_id); |
|
| 350 | + $mother->setAttribute('parent_union', 'u' . $mother->child_in_family_id); |
|
| 351 | 351 | // add to person |
| 352 | 352 | $this->persons[$mother->id] = $mother; |
| 353 | 353 | // add current family link |
| 354 | 354 | // $this->links[] = [$mother->id, 'u'.$family_id]; |
| 355 | - array_unshift($this->links, [$mother->id, 'u'.$family_id]); |
|
| 355 | + array_unshift($this->links, [$mother->id, 'u' . $family_id]); |
|
| 356 | 356 | // get wifee's parents data |
| 357 | 357 | $p_family_id = $mother->child_in_family_id; |
| 358 | - if (! empty($p_family_id)) { |
|
| 358 | + if (!empty($p_family_id)) { |
|
| 359 | 359 | // add parent family link |
| 360 | 360 | // $this->links[] = ['u'.$p_family_id, $father->id] ; |
| 361 | - array_unshift($this->links, ['u'.$p_family_id, $mother->id]); |
|
| 361 | + array_unshift($this->links, ['u' . $p_family_id, $mother->id]); |
|
| 362 | 362 | |
| 363 | 363 | $p_family = Family::on($conn)->find($p_family_id); |
| 364 | 364 | if (isset($p_family->husband_id)) { |
@@ -383,10 +383,10 @@ discard block |
||
| 383 | 383 | |
| 384 | 384 | // compose union item and add to unions |
| 385 | 385 | $union = []; |
| 386 | - $union['id'] = 'u'.$family_id; |
|
| 386 | + $union['id'] = 'u' . $family_id; |
|
| 387 | 387 | $union['partner'] = [isset($father->id) ? $father->id : null, isset($mother->id) ? $mother->id : null]; |
| 388 | 388 | $union['children'] = $children_ids; |
| 389 | - $this->unions['u'.$family_id] = $union; |
|
| 389 | + $this->unions['u' . $family_id] = $union; |
|
| 390 | 390 | } |
| 391 | 391 | // get brother/sisters |
| 392 | 392 | $brothers = Person::on($conn)->where('child_in_family_id', $person->child_in_family_id) |
@@ -443,7 +443,7 @@ discard block |
||
| 443 | 443 | public function destroy($id) |
| 444 | 444 | { |
| 445 | 445 | $tree = Tree::find($id); |
| 446 | - if($tree) { |
|
| 446 | + if ($tree) { |
|
| 447 | 447 | $tree->delete(); |
| 448 | 448 | return "true"; |
| 449 | 449 | } |
@@ -16,34 +16,34 @@ discard block |
||
| 16 | 16 | { |
| 17 | 17 | $query = SourceRepo::query(); |
| 18 | 18 | |
| 19 | - if($request->has('searchTerm')) { |
|
| 19 | + if ($request->has('searchTerm')) { |
|
| 20 | 20 | $columnsToSearch = ['group', 'repo_id', 'caln']; |
| 21 | 21 | $search_term = json_decode($request->searchTerm)->searchTerm; |
| 22 | - if(!empty($search_term)) { |
|
| 22 | + if (!empty($search_term)) { |
|
| 23 | 23 | $searchQuery = '%' . $search_term . '%'; |
| 24 | - foreach($columnsToSearch as $column) { |
|
| 24 | + foreach ($columnsToSearch as $column) { |
|
| 25 | 25 | $query->orWhere($column, 'LIKE', $searchQuery); |
| 26 | 26 | } |
| 27 | 27 | } |
| 28 | 28 | } |
| 29 | 29 | |
| 30 | - if($request->has('columnFilters')) { |
|
| 30 | + if ($request->has('columnFilters')) { |
|
| 31 | 31 | |
| 32 | 32 | $filters = get_object_vars(json_decode($request->columnFilters)); |
| 33 | 33 | |
| 34 | - foreach($filters as $key => $value) { |
|
| 35 | - if(!empty($value)) { |
|
| 34 | + foreach ($filters as $key => $value) { |
|
| 35 | + if (!empty($value)) { |
|
| 36 | 36 | $query->orWhere($key, 'like', '%' . $value . '%'); |
| 37 | 37 | } |
| 38 | 38 | } |
| 39 | 39 | } |
| 40 | 40 | |
| 41 | - if($request->has('sort.0')) { |
|
| 41 | + if ($request->has('sort.0')) { |
|
| 42 | 42 | $sort = json_decode($request->sort[0]); |
| 43 | 43 | $query->orderBy($sort->field, $sort->type); |
| 44 | 44 | } |
| 45 | 45 | |
| 46 | - if($request->has("perPage")) { |
|
| 46 | + if ($request->has("perPage")) { |
|
| 47 | 47 | $rows = $query->paginate($request->perPage); |
| 48 | 48 | } |
| 49 | 49 | |
@@ -136,7 +136,7 @@ discard block |
||
| 136 | 136 | public function destroy($id) |
| 137 | 137 | { |
| 138 | 138 | $sourcerepo = SourceRepo::find($id); |
| 139 | - if($sourcerepo) { |
|
| 139 | + if ($sourcerepo) { |
|
| 140 | 140 | $sourcerepo->delete(); |
| 141 | 141 | return "true"; |
| 142 | 142 | } |
@@ -16,34 +16,34 @@ discard block |
||
| 16 | 16 | { |
| 17 | 17 | $query = PersonEvent::query(); |
| 18 | 18 | |
| 19 | - if($request->has('searchTerm')) { |
|
| 20 | - $columnsToSearch = ['converted_date', 'year', 'month','day','type','attr','plac','addr_id','phon','caus','age','agnc','adop','adop_famc','person_id','title','date','description','places_id']; |
|
| 19 | + if ($request->has('searchTerm')) { |
|
| 20 | + $columnsToSearch = ['converted_date', 'year', 'month', 'day', 'type', 'attr', 'plac', 'addr_id', 'phon', 'caus', 'age', 'agnc', 'adop', 'adop_famc', 'person_id', 'title', 'date', 'description', 'places_id']; |
|
| 21 | 21 | $search_term = json_decode($request->searchTerm)->searchTerm; |
| 22 | - if(!empty($search_term)) { |
|
| 22 | + if (!empty($search_term)) { |
|
| 23 | 23 | $searchQuery = '%' . $search_term . '%'; |
| 24 | - foreach($columnsToSearch as $column) { |
|
| 24 | + foreach ($columnsToSearch as $column) { |
|
| 25 | 25 | $query->orWhere($column, 'LIKE', $searchQuery); |
| 26 | 26 | } |
| 27 | 27 | } |
| 28 | 28 | } |
| 29 | 29 | |
| 30 | - if($request->has('columnFilters')) { |
|
| 30 | + if ($request->has('columnFilters')) { |
|
| 31 | 31 | |
| 32 | 32 | $filters = get_object_vars(json_decode($request->columnFilters)); |
| 33 | 33 | |
| 34 | - foreach($filters as $key => $value) { |
|
| 35 | - if(!empty($value)) { |
|
| 34 | + foreach ($filters as $key => $value) { |
|
| 35 | + if (!empty($value)) { |
|
| 36 | 36 | $query->orWhere($key, 'like', '%' . $value . '%'); |
| 37 | 37 | } |
| 38 | 38 | } |
| 39 | 39 | } |
| 40 | 40 | |
| 41 | - if($request->has('sort.0')) { |
|
| 41 | + if ($request->has('sort.0')) { |
|
| 42 | 42 | $sort = json_decode($request->sort[0]); |
| 43 | 43 | $query->orderBy($sort->field, $sort->type); |
| 44 | 44 | } |
| 45 | 45 | |
| 46 | - if($request->has("perPage")) { |
|
| 46 | + if ($request->has("perPage")) { |
|
| 47 | 47 | $rows = $query->paginate($request->perPage); |
| 48 | 48 | } |
| 49 | 49 | |
@@ -199,7 +199,7 @@ discard block |
||
| 199 | 199 | public function destroy($id) |
| 200 | 200 | { |
| 201 | 201 | $personevent = PersonEvent::find($id); |
| 202 | - if($personevent) { |
|
| 202 | + if ($personevent) { |
|
| 203 | 203 | $personevent->delete(); |
| 204 | 204 | return "true"; |
| 205 | 205 | } |
@@ -17,8 +17,8 @@ discard block |
||
| 17 | 17 | } |
| 18 | 18 | |
| 19 | 19 | public function getPlans() { |
| 20 | - foreach($this->plans as $plan) { |
|
| 21 | - switch($plan->nickname) { |
|
| 20 | + foreach ($this->plans as $plan) { |
|
| 21 | + switch ($plan->nickname) { |
|
| 22 | 22 | case 'UTY': |
| 23 | 23 | $plan->title = '50GBP for unlimited trees yearly'; |
| 24 | 24 | break; |
@@ -65,11 +65,11 @@ discard block |
||
| 65 | 65 | $user = auth()->user(); |
| 66 | 66 | $user->syncRoles('OTY'); |
| 67 | 67 | $plan_id = request()->plan_id; |
| 68 | - if(request()->has('payment_method')) { |
|
| 68 | + if (request()->has('payment_method')) { |
|
| 69 | 69 | $paymentMethod = request()->payment_method; |
| 70 | - $user->newSubscription('default', $plan_id)->create($paymentMethod,['name' => request()->card_holder_name, "address" => ["country" => 'GB', "state" => 'England', "city" => 'Abberley', "postal_code" => 'WR6', "line1" => 'test', "line2" => ""]]); |
|
| 70 | + $user->newSubscription('default', $plan_id)->create($paymentMethod, ['name' => request()->card_holder_name, "address" => ["country" => 'GB', "state" => 'England', "city" => 'Abberley', "postal_code" => 'WR6', "line1" => 'test', "line2" => ""]]); |
|
| 71 | 71 | $user->notify(new SubscribeSuccessfully($plan_id)); |
| 72 | - } else if($user->hasDefaultPaymentMethod()) { |
|
| 72 | + } else if ($user->hasDefaultPaymentMethod()) { |
|
| 73 | 73 | $paymentMethod = $user->defaultPaymentMethod(); |
| 74 | 74 | $user->newSubscription('default', $plan_id)->create($paymentMethod->id); |
| 75 | 75 | $user->notify(new SubscribeSuccessfully($plan_id)); |
@@ -91,11 +91,11 @@ discard block |
||
| 91 | 91 | public function webhook() { |
| 92 | 92 | $data = request()->all(); |
| 93 | 93 | $user = User::where('stripe_id', $data['data']['object']['customer'])->first(); |
| 94 | - if($user) { |
|
| 94 | + if ($user) { |
|
| 95 | 95 | $plan_nickname = $data['data']['object']['items']['data'][0]['plan']['nickname']; |
| 96 | - foreach($this->plans as $plan) { |
|
| 97 | - if($plan->nickname == $plan_nickname) { |
|
| 98 | - switch($plan->nickname) { |
|
| 96 | + foreach ($this->plans as $plan) { |
|
| 97 | + if ($plan->nickname == $plan_nickname) { |
|
| 98 | + switch ($plan->nickname) { |
|
| 99 | 99 | case 'UTY': |
| 100 | 100 | $user->syncRoles('UTY'); |
| 101 | 101 | break; |
@@ -18,34 +18,34 @@ |
||
| 18 | 18 | { |
| 19 | 19 | $query = Dna::query(); |
| 20 | 20 | |
| 21 | - if($request->has('searchTerm')) { |
|
| 21 | + if ($request->has('searchTerm')) { |
|
| 22 | 22 | $columnsToSearch = ['name']; |
| 23 | 23 | $search_term = json_decode($request->searchTerm)->searchTerm; |
| 24 | - if(!empty($search_term)) { |
|
| 24 | + if (!empty($search_term)) { |
|
| 25 | 25 | $searchQuery = '%' . $search_term . '%'; |
| 26 | - foreach($columnsToSearch as $column) { |
|
| 26 | + foreach ($columnsToSearch as $column) { |
|
| 27 | 27 | $query->orWhere($column, 'LIKE', $searchQuery); |
| 28 | 28 | } |
| 29 | 29 | } |
| 30 | 30 | } |
| 31 | 31 | |
| 32 | - if($request->has('columnFilters')) { |
|
| 32 | + if ($request->has('columnFilters')) { |
|
| 33 | 33 | |
| 34 | 34 | $filters = get_object_vars(json_decode($request->columnFilters)); |
| 35 | 35 | |
| 36 | - foreach($filters as $key => $value) { |
|
| 37 | - if(!empty($value)) { |
|
| 36 | + foreach ($filters as $key => $value) { |
|
| 37 | + if (!empty($value)) { |
|
| 38 | 38 | $query->orWhere($key, 'like', '%' . $value . '%'); |
| 39 | 39 | } |
| 40 | 40 | } |
| 41 | 41 | } |
| 42 | 42 | |
| 43 | - if($request->has('sort.0')) { |
|
| 43 | + if ($request->has('sort.0')) { |
|
| 44 | 44 | $sort = json_decode($request->sort[0]); |
| 45 | 45 | $query->orderBy($sort->field, $sort->type); |
| 46 | 46 | } |
| 47 | 47 | |
| 48 | - if($request->has("perPage")) { |
|
| 48 | + if ($request->has("perPage")) { |
|
| 49 | 49 | $rows = $query->paginate($request->perPage); |
| 50 | 50 | } |
| 51 | 51 | |