Test Setup Failed
Branch master (2cef12)
by Curtis
15:04
created
app/Http/Controllers/EventController.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -16,34 +16,34 @@  discard block
 block discarded – undo
16 16
     {
17 17
         $query = Event::query();
18 18
 
19
-        if($request->has('searchTerm')) {
19
+        if ($request->has('searchTerm')) {
20 20
             $columnsToSearch = ['name', 'email', 'phone'];
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
 
@@ -127,7 +127,7 @@  discard block
 block discarded – undo
127 127
     public function destroy($id)
128 128
     {
129 129
         $event = Event::find($id);
130
-        if($event) {
130
+        if ($event) {
131 131
             $event->delete();
132 132
             return "true";
133 133
         }
Please login to merge, or discard this patch.
app/Http/Controllers/SourceController.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -16,39 +16,39 @@  discard block
 block discarded – undo
16 16
      */
17 17
     public function index(Request $request)
18 18
     {
19
-        $query = Source::query()->with(['publication','repositories','author','type']);
19
+        $query = Source::query()->with(['publication', 'repositories', 'author', 'type']);
20 20
 
21
-        if($request->has('searchTerm')) {
22
-            $columnsToSearch = ['titl', 'sour', 'auth','data','text','publ','abbr','name','description','repository_id','author_id','publication_id','type_id','is_active','group','quay','page'];
21
+        if ($request->has('searchTerm')) {
22
+            $columnsToSearch = ['titl', 'sour', 'auth', 'data', 'text', 'publ', 'abbr', 'name', 'description', 'repository_id', 'author_id', 'publication_id', 'type_id', 'is_active', 'group', 'quay', 'page'];
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
-            $relationship_column = array('repositories.name','author.name','publication.name','type.name');
36
-            foreach($filters as $key => $value) {
37
-                if(!in_array($key, $relationship_column))
35
+            $relationship_column = array('repositories.name', 'author.name', 'publication.name', 'type.name');
36
+            foreach ($filters as $key => $value) {
37
+                if (!in_array($key, $relationship_column))
38 38
                 {
39
-                    if(!empty($value)) {
39
+                    if (!empty($value)) {
40 40
                         $query->orWhere($key, 'like', '%' . $value . '%');
41 41
                     }
42 42
                 }
43 43
             }
44 44
         }
45 45
 
46
-        if($request->has('sort.0')) {
46
+        if ($request->has('sort.0')) {
47 47
             $sort = json_decode($request->sort[0]);
48 48
             $query->orderBy($sort->field, $sort->type);
49 49
         }
50 50
 
51
-        if($request->has("perPage")) {
51
+        if ($request->has("perPage")) {
52 52
             $rows = $query->paginate($request->perPage);
53 53
         }
54 54
 
@@ -180,7 +180,7 @@  discard block
 block discarded – undo
180 180
     public function destroy($id)
181 181
     {
182 182
         $source = Source::find($id);
183
-        if($source) {
183
+        if ($source) {
184 184
             $source->delete();
185 185
             return "true";
186 186
         }
Please login to merge, or discard this patch.
app/Http/Controllers/RegisterController.php 1 patch
Indentation   +95 added lines, -95 removed lines patch added patch discarded remove patch
@@ -10,121 +10,121 @@
 block discarded – undo
10 10
 use Spatie\Multitenancy\Models\Concerns\UsesLandlordConnection;
11 11
 use Illuminate\Auth\Events\Registered;
12 12
 class RegisterController extends Controller {
13
-	use UsesLandlordConnection;
14
-
15
-	public function register(Request $request) {
16
-
17
-		$request->validate([
18
-			'first_name' => ['required'],
19
-			'last_name' => ['required'],
20
-			'email' => ['required', 'email', 'unique:landlord.users'],
21
-			'password' => ['required', 'min:8', 'confirmed'],
22
-		]);
23
-
24
-		DB::connection($this->getConnectionName())->beginTransaction();
25
-
26
-		try
27
-		{
28
-
29
-		// $user_id = DB::connection($this->getConnectionName())->table('users')->insertGetId([
30
-		// 	'first_name' => $request->first_name,
31
-		// 	'last_name' => $request->last_name,
32
-		// 	'email' => $request->email,
33
-		// 	'password' => bcrypt($request->password),
34
-		// ]);
35
-		// $user = User::create([
36
-		// 	'first_name' => $request->first_name,
37
-		// 	'last_name' => $request->last_name,
38
-		// 	'email' => $request->email,
39
-		// 	'password' => bcrypt($request->password)
40
-		// ]);
41
-
42
-		$user = new User;
43
-
44
-		$user->first_name = $request->first_name;
45
-		$user->last_name = $request->last_name;
46
-		$user->email = $request->email;
47
-		$user->password = bcrypt($request->password);
48
-		$user->save();
49
-		event(new Registered($user));
50
-		$user_id = $user->id;
51
-		$user = User::find($user_id);
13
+    use UsesLandlordConnection;
14
+
15
+    public function register(Request $request) {
16
+
17
+        $request->validate([
18
+            'first_name' => ['required'],
19
+            'last_name' => ['required'],
20
+            'email' => ['required', 'email', 'unique:landlord.users'],
21
+            'password' => ['required', 'min:8', 'confirmed'],
22
+        ]);
23
+
24
+        DB::connection($this->getConnectionName())->beginTransaction();
25
+
26
+        try
27
+        {
28
+
29
+        // $user_id = DB::connection($this->getConnectionName())->table('users')->insertGetId([
30
+        // 	'first_name' => $request->first_name,
31
+        // 	'last_name' => $request->last_name,
32
+        // 	'email' => $request->email,
33
+        // 	'password' => bcrypt($request->password),
34
+        // ]);
35
+        // $user = User::create([
36
+        // 	'first_name' => $request->first_name,
37
+        // 	'last_name' => $request->last_name,
38
+        // 	'email' => $request->email,
39
+        // 	'password' => bcrypt($request->password)
40
+        // ]);
41
+
42
+        $user = new User;
43
+
44
+        $user->first_name = $request->first_name;
45
+        $user->last_name = $request->last_name;
46
+        $user->email = $request->email;
47
+        $user->password = bcrypt($request->password);
48
+        $user->save();
49
+        event(new Registered($user));
50
+        $user_id = $user->id;
51
+        $user = User::find($user_id);
52 52
         $user->assignRole('free');
53 53
         // $user->sendEmailVerificationNotification();
54 54
 
55
-		$random = $this->unique_random('companies', 'name', 5);
56
-		$company_id = DB::connection($this->getConnectionName())->table('companies')->insertGetId([
57
-			'name' => 'company' . $random,
58
-			'status' => 1,
59
-			'current_tenant' => 1,
60
-		]);
55
+        $random = $this->unique_random('companies', 'name', 5);
56
+        $company_id = DB::connection($this->getConnectionName())->table('companies')->insertGetId([
57
+            'name' => 'company' . $random,
58
+            'status' => 1,
59
+            'current_tenant' => 1,
60
+        ]);
61 61
 
62
-		DB::connection($this->getConnectionName())->table('user_company')->insert([
63
-			'user_id' => $user_id,
64
-			'company_id' => $company_id,
65
-		]);
62
+        DB::connection($this->getConnectionName())->table('user_company')->insert([
63
+            'user_id' => $user_id,
64
+            'company_id' => $company_id,
65
+        ]);
66 66
 
67
-		$tree_id = DB::connection($this->getConnectionName())->table('trees')->insertGetId([
68
-			'company_id' => $company_id,
69
-			'name' => 'tree' . $company_id,
70
-			'description' => '',
71
-			'current_tenant' => 1,
72
-		]);
67
+        $tree_id = DB::connection($this->getConnectionName())->table('trees')->insertGetId([
68
+            'company_id' => $company_id,
69
+            'name' => 'tree' . $company_id,
70
+            'description' => '',
71
+            'current_tenant' => 1,
72
+        ]);
73 73
 
74
-		$tenant_id = DB::connection($this->getConnectionName())->table('tenants')->insertGetId([
75
-			'name' => 'tenant' . $tree_id,
76
-			'tree_id' => $tree_id,
77
-			'database' => 'tenant' . $tree_id,
78
-		]);
74
+        $tenant_id = DB::connection($this->getConnectionName())->table('tenants')->insertGetId([
75
+            'name' => 'tenant' . $tree_id,
76
+            'tree_id' => $tree_id,
77
+            'database' => 'tenant' . $tree_id,
78
+        ]);
79 79
 
80
-		DB::statement('create database tenant' . $tree_id);
80
+        DB::statement('create database tenant' . $tree_id);
81 81
 
82
-		Artisan::call('tenants:artisan "migrate --database=tenant --force"');
83
-		} catch (Exception $e) {
84
-			DB::connection($this->getConnectionName())->rollback();
85
-		}
82
+        Artisan::call('tenants:artisan "migrate --database=tenant --force"');
83
+        } catch (Exception $e) {
84
+            DB::connection($this->getConnectionName())->rollback();
85
+        }
86 86
 
87
-		DB::connection($this->getConnectionName())->commit();
88
-	}
87
+        DB::connection($this->getConnectionName())->commit();
88
+    }
89 89
 
90
-	public function unique_random($table, $col, $chars = 16) {
90
+    public function unique_random($table, $col, $chars = 16) {
91 91
 
92
-		$unique = false;
92
+        $unique = false;
93 93
 
94
-		// Store tested results in array to not test them again
95
-		$tested = [];
94
+        // Store tested results in array to not test them again
95
+        $tested = [];
96 96
 
97
-		do {
97
+        do {
98 98
 
99
-			// Generate random string of characters
100
-			$random = Str::random($chars);
99
+            // Generate random string of characters
100
+            $random = Str::random($chars);
101 101
 
102
-			// Check if it's already testing
103
-			// If so, don't query the database again
104
-			if (in_array($random, $tested)) {
105
-				continue;
106
-			}
102
+            // Check if it's already testing
103
+            // If so, don't query the database again
104
+            if (in_array($random, $tested)) {
105
+                continue;
106
+            }
107 107
 
108
-			// Check if it is unique in the database
109
-			$count = DB::connection($this->getConnectionName())->table('companies')->where($col, '=', $random)->count();
108
+            // Check if it is unique in the database
109
+            $count = DB::connection($this->getConnectionName())->table('companies')->where($col, '=', $random)->count();
110 110
 
111
-			// Store the random character in the tested array
112
-			// To keep track which ones are already tested
113
-			$tested[] = $random;
111
+            // Store the random character in the tested array
112
+            // To keep track which ones are already tested
113
+            $tested[] = $random;
114 114
 
115
-			// String appears to be unique
116
-			if ($count == 0) {
117
-				// Set unique to true to break the loop
118
-				$unique = true;
119
-			}
115
+            // String appears to be unique
116
+            if ($count == 0) {
117
+                // Set unique to true to break the loop
118
+                $unique = true;
119
+            }
120 120
 
121
-			// If unique is still false at this point
122
-			// it will just repeat all the steps until
123
-			// it has generated a random string of characters
121
+            // If unique is still false at this point
122
+            // it will just repeat all the steps until
123
+            // it has generated a random string of characters
124 124
 
125
-		} while (!$unique);
125
+        } while (!$unique);
126 126
 
127
-		return $random;
128
-	}
127
+        return $random;
128
+    }
129 129
 
130 130
 }
Please login to merge, or discard this patch.
app/Http/Controllers/RepositoryController.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -13,39 +13,39 @@  discard block
 block discarded – undo
13 13
      */
14 14
     public function index(Request $request)
15 15
     {
16
-        $query = Repository::query()->with(['type','addr']);
16
+        $query = Repository::query()->with(['type', 'addr']);
17 17
 
18
-        if($request->has('searchTerm')) {
19
-            $columnsToSearch = ['repo','name','addr_id','rin','email','phon','fax','www','description','type_id','is_active'];
18
+        if ($request->has('searchTerm')) {
19
+            $columnsToSearch = ['repo', 'name', 'addr_id', 'rin', 'email', 'phon', 'fax', 'www', 'description', 'type_id', 'is_active'];
20 20
             $search_term = json_decode($request->searchTerm)->searchTerm;
21
-            if(!empty($search_term)) {
21
+            if (!empty($search_term)) {
22 22
                 $searchQuery = '%' . $search_term . '%';
23
-                foreach($columnsToSearch as $column) {
23
+                foreach ($columnsToSearch as $column) {
24 24
                     $query->orWhere($column, 'LIKE', $searchQuery);
25 25
                 }
26 26
             }
27 27
         }
28 28
 
29
-        if($request->has('columnFilters')) {
29
+        if ($request->has('columnFilters')) {
30 30
 
31 31
             $filters = get_object_vars(json_decode($request->columnFilters));
32
-            $relationship_column = array('addr.adr1','type.name');
33
-            foreach($filters as $key => $value) {
34
-                if(!in_array($key, $relationship_column))
32
+            $relationship_column = array('addr.adr1', 'type.name');
33
+            foreach ($filters as $key => $value) {
34
+                if (!in_array($key, $relationship_column))
35 35
                 {
36
-                    if(!empty($value)) {
36
+                    if (!empty($value)) {
37 37
                         $query->orWhere($key, 'like', '%' . $value . '%');
38 38
                     }
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
 
@@ -159,7 +159,7 @@  discard block
 block discarded – undo
159 159
     public function destroy($id)
160 160
     {
161 161
         $repository = Repository::find($id);
162
-        if($repository) {
162
+        if ($repository) {
163 163
             $repository->delete();
164 164
             return "true";
165 165
         }
Please login to merge, or discard this patch.
app/Http/Controllers/PedigreeController.php 1 patch
Spacing   +41 added lines, -41 removed lines patch added patch discarded remove patch
@@ -76,12 +76,12 @@  discard block
 block discarded – undo
76 76
 
77 77
             if ($person) {
78 78
                 $user = $person->user;
79
-                if($user) {
79
+                if ($user) {
80 80
                     $av = Avatar::where('user_id', '=', $user->id)->first();
81 81
                     $file = UploadFile::where('attachable_id', '=', $av->id)->where('attachable_type', '=', 'avatar')->first();
82 82
 
83 83
                     if ($file) {
84
-                        $person->setAttribute('avatar', '/api/core/avatars/'.$av->id);
84
+                        $person->setAttribute('avatar', '/api/core/avatars/' . $av->id);
85 85
                     } else {
86 86
                         $person->setAttribute('avatar', '');
87 87
                     }
@@ -98,37 +98,37 @@  discard block
 block discarded – undo
98 98
                 return;
99 99
             }
100 100
             // do self
101
-            if (! array_key_exists($start_id, $this->persons)) {
101
+            if (!array_key_exists($start_id, $this->persons)) {
102 102
                 // this is not added
103 103
                 $_families = Family::where('husband_id', $start_id)->orwhere('wife_id', $start_id)->select('id')->get();
104 104
                 $_union_ids = [];
105 105
                 foreach ($_families as $item) {
106 106
 
107
-                    $_union_ids[] = 'u'.$item->id;
107
+                    $_union_ids[] = 'u' . $item->id;
108 108
                     // add current family link
109 109
                     // $this->links[] = [$start_id, 'u'.$item->id];
110
-                    array_unshift($this->links, [$start_id, 'u'.$item->id]);
110
+                    array_unshift($this->links, [$start_id, 'u' . $item->id]);
111 111
                 }
112 112
                 $person->setAttribute('own_unions', $_union_ids);
113
-                $person->setAttribute('parent_union', 'u'.$person->child_in_family_id);
113
+                $person->setAttribute('parent_union', 'u' . $person->child_in_family_id);
114 114
                 // add to persons
115 115
                 $this->persons[$start_id] = $person; 
116 116
 
117 117
                 // get self's parents data
118
-                if($person) {
119
-                if($person->id == 680) {
120
-                        array_unshift($this->person_id, 'first'.$person->id);
118
+                if ($person) {
119
+                if ($person->id == 680) {
120
+                        array_unshift($this->person_id, 'first' . $person->id);
121 121
                     }
122 122
             }
123 123
                 $p_family_id = $person->child_in_family_id;
124
-                array_unshift($this->start_id, 'family_in_child_id'.$person->child_in_family_id);
125
-                if($p_family_id) {
126
-                        array_unshift($this->family_id, 'first'.$p_family_id);
124
+                array_unshift($this->start_id, 'family_in_child_id' . $person->child_in_family_id);
125
+                if ($p_family_id) {
126
+                        array_unshift($this->family_id, 'first' . $p_family_id);
127 127
                     }
128
-                if (! empty($p_family_id)) {
128
+                if (!empty($p_family_id)) {
129 129
                     // add parent family link
130 130
                     // $this->links[] = ['u'.$p_family_id,  $start_id] ;
131
-                    array_unshift($this->links, ['u'.$p_family_id,  $start_id]);
131
+                    array_unshift($this->links, ['u' . $p_family_id, $start_id]);
132 132
                     $p_family = Family::find($p_family_id);
133 133
                     if (isset($p_family->husband_id)) {
134 134
                         $p_fatherid = $p_family->husband_id;
@@ -147,14 +147,14 @@  discard block
 block discarded – undo
147 147
                 $father = Person::find($family->husband_id);
148 148
                 $mother = Person::find($family->wife_id);
149 149
                     
150
-                $user = NULL;//$father->user;
150
+                $user = NULL; //$father->user;
151 151
 
152
-                if($user) {
152
+                if ($user) {
153 153
                     $av = Avatar::where('user_id', '=', $user->id)->first();
154 154
                     $file = UploadFile::where('attachable_id', '=', $av->id)->where('attachable_type', '=', 'avatar')->first();
155 155
 
156 156
                     if ($file) {
157
-                        $father->setAttribute('avatar', '/api/core/avatars/'.$av->id);
157
+                        $father->setAttribute('avatar', '/api/core/avatars/' . $av->id);
158 158
                     } else {
159 159
                         $father->setAttribute('avatar', '');
160 160
                     }
@@ -164,12 +164,12 @@  discard block
 block discarded – undo
164 164
                 if ($mother) {
165 165
                     $user = $mother->user;
166 166
 
167
-                    if($user) {
167
+                    if ($user) {
168 168
                         $av = Avatar::where('user_id', '=', $user->id)->first();
169 169
                         $file = UploadFile::where('attachable_id', '=', $av->id)->where('attachable_type', '=', 'avatar')->first();
170 170
 
171 171
                         if ($file) {
172
-                            $mother->setAttribute('avatar', '/api/core/avatars/'.$av->id);
172
+                            $mother->setAttribute('avatar', '/api/core/avatars/' . $av->id);
173 173
                         } else {
174 174
                             $mother->setAttribute('avatar', '');
175 175
                         }
@@ -178,30 +178,30 @@  discard block
 block discarded – undo
178 178
                 }
179 179
 
180 180
                 if (isset($father->id)) {
181
-                    if (! array_key_exists($father->id, $this->persons)) {
181
+                    if (!array_key_exists($father->id, $this->persons)) {
182 182
                         // this is not added
183 183
                         $_families = Family::where('husband_id', $father->id)->orwhere('wife_id', $father->id)->select('id')->get();
184 184
                         $_union_ids = [];
185 185
                         foreach ($_families as $item) {
186
-                            $_union_ids[] = 'u'.$item->id;
186
+                            $_union_ids[] = 'u' . $item->id;
187 187
                         }
188 188
                         $father->setAttribute('own_unions', $_union_ids);
189
-                        $father->setAttribute('parent_union', 'u'.$father->child_in_family_id);
189
+                        $father->setAttribute('parent_union', 'u' . $father->child_in_family_id);
190 190
                         // add to persons
191 191
                         $this->persons[$father->id] = $father;
192 192
 
193 193
                         // add current family link
194 194
                         // $this->links[] = [$father->id, 'u'.$family_id];
195
-                        array_unshift($this->links, [$father->id, 'u'.$family_id]);
195
+                        array_unshift($this->links, [$father->id, 'u' . $family_id]);
196 196
                         // get husband's parents data
197 197
                         $p_family_id = $father->child_in_family_id;
198
-                        if($p_family_id) {
199
-                        array_unshift($this->family_id, 'father'.$p_family_id);
198
+                        if ($p_family_id) {
199
+                        array_unshift($this->family_id, 'father' . $p_family_id);
200 200
                     }
201
-                        if (! empty($p_family_id)) {
201
+                        if (!empty($p_family_id)) {
202 202
                             // add parent family link
203 203
                             // $this->links[] = ['u'.$p_family_id,  $father->id] ;
204
-                            array_unshift($this->links, ['u'.$p_family_id,  $father->id]);
204
+                            array_unshift($this->links, ['u' . $p_family_id, $father->id]);
205 205
                             $p_family = Family::find($p_family_id);
206 206
                             if (isset($p_family->husband_id)) {
207 207
                                 $p_fatherid = $p_family->husband_id;
@@ -215,7 +215,7 @@  discard block
 block discarded – undo
215 215
                     }
216 216
                 }
217 217
                 if (isset($mother->id)) {
218
-                    if (! array_key_exists($mother->id, $this->persons)) {
218
+                    if (!array_key_exists($mother->id, $this->persons)) {
219 219
                         // this is not added
220 220
                         $_families = Family::where('husband_id', $mother->id)->orwhere('wife_id', $mother->id)->select('id')->get();
221 221
                         $_union_ids = [];
@@ -223,30 +223,30 @@  discard block
 block discarded – undo
223 223
                             $_union_ids[] = $item->id;
224 224
                         }
225 225
                         $mother->setAttribute('own_unions', $_union_ids);
226
-                        $mother->setAttribute('parent_union', 'u'.$mother->child_in_family_id);
226
+                        $mother->setAttribute('parent_union', 'u' . $mother->child_in_family_id);
227 227
                         // add to person
228 228
                         $this->persons[$mother->id] = $mother;
229 229
                         // add current family link
230 230
                         // $this->links[] = [$mother->id, 'u'.$family_id];
231
-                        array_unshift($this->links, [$mother->id, 'u'.$family_id]);
231
+                        array_unshift($this->links, [$mother->id, 'u' . $family_id]);
232 232
                         // get wifee's parents data
233 233
                         $p_family_id = $mother->child_in_family_id;
234
-                        if($p_family_id) {
234
+                        if ($p_family_id) {
235 235
                         
236 236
                     }
237
-                        if (! empty($p_family_id)) {
237
+                        if (!empty($p_family_id)) {
238 238
                             // add parent family link
239 239
                             // $this->links[] = ['u'.$p_family_id,  $father->id] ;
240
-                            array_unshift($this->links, ['u'.$p_family_id,  $mother->id]);
240
+                            array_unshift($this->links, ['u' . $p_family_id, $mother->id]);
241 241
 
242 242
                             $p_family = Family::find($p_family_id);
243 243
                             if (isset($p_family->husband_id)) {
244
-                                array_unshift($this->family_id, 'mother'.$p_family_id);
244
+                                array_unshift($this->family_id, 'mother' . $p_family_id);
245 245
                                 $p_fatherid = $p_family->husband_id;
246 246
                                 $this->getGraphDataUpward($p_fatherid, $nest + 1);
247 247
                             }
248 248
                             if (isset($p_family->wife_id)) {
249
-                                array_unshift($this->family_id, 'mother'.$p_family_id);
249
+                                array_unshift($this->family_id, 'mother' . $p_family_id);
250 250
                                 $p_motherid = $p_family->wife_id;
251 251
                                 $this->getGraphDataUpward($p_motherid, $nest + 1);
252 252
                             }
@@ -258,8 +258,8 @@  discard block
 block discarded – undo
258 258
                 $children = Person::where('child_in_family_id', $family_id)->get();
259 259
                 $children_ids = [];
260 260
                 foreach ($children as $child) {
261
-                    $this->getGraphDataUpward($child->id, $nest+1);
262
-                    if($child->id == 680) {
261
+                    $this->getGraphDataUpward($child->id, $nest + 1);
262
+                    if ($child->id == 680) {
263 263
                         array_unshift($this->family_id, $child->id);
264 264
                     }
265 265
                     $child_id = $child->id;
@@ -268,20 +268,20 @@  discard block
 block discarded – undo
268 268
 
269 269
                 // compose union item and add to unions
270 270
                 $union = [];
271
-                $union['id'] = 'u'.$family_id;
271
+                $union['id'] = 'u' . $family_id;
272 272
                 $union['partner'] = [isset($father->id) ? $father->id : null, isset($mother->id) ? $mother->id : null];
273 273
                 $union['children'] = $children_ids;
274
-                $this->unions['u'.$family_id] = $union;
274
+                $this->unions['u' . $family_id] = $union;
275 275
             }
276 276
             //get brother/sisters
277
-            $i =0;
277
+            $i = 0;
278 278
             $brothers = Person::where('child_in_family_id', $person->child_in_family_id)
279 279
                 ->whereNotNull('child_in_family_id')
280 280
                 ->where('id', '<>', $start_id)->get();
281 281
 
282 282
             foreach ($brothers as $brother) {
283 283
                 // if($i < 2) {
284
-                    $this->getGraphDataUpward($brother->id, $nest+1);
284
+                    $this->getGraphDataUpward($brother->id, $nest + 1);
285 285
                 // }
286 286
                 $i++;
287 287
             }
Please login to merge, or discard this patch.
app/Http/Controllers/DashboardController.php 2 patches
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -25,7 +25,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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);
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -69,8 +69,7 @@
 block discarded – undo
69 69
             $tree->current_tenant = 1;
70 70
             $tree->save();
71 71
             return response()->json(['changedb' => true]);
72
-        }
73
-        else {
72
+        } else {
74 73
             return response()->json(['changedb' => false]);
75 74
         }
76 75
     }
Please login to merge, or discard this patch.
app/Http/Controllers/PersonAssoController.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -16,34 +16,34 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
         }
Please login to merge, or discard this patch.
app/Http/Controllers/FamilyEventController.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -18,36 +18,36 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
         }
Please login to merge, or discard this patch.
app/Http/Controllers/AddrController.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -16,34 +16,34 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
         }
Please login to merge, or discard this patch.