@@ -35,19 +35,19 @@ |
||
35 | 35 | people.titl AS title, people.givn, people.surn, people.appellative, people.email, people.phone, |
36 | 36 | people.birthday, people.deathday, CASE WHEN users.id is null THEN 0 ELSE 1 END as "user", |
37 | 37 | companies.name as company, people.created_at |
38 | - ')->leftJoin('users', function ($join) use ($userId) { |
|
38 | + ')->leftJoin('users', function($join) use ($userId) { |
|
39 | 39 | $join->on('people.id', '=', 'users.person_id') |
40 | 40 | ->where('users.id', $userId); |
41 | 41 | }) |
42 | 42 | ->leftJoin( |
43 | 43 | 'company_person', |
44 | - function ($join) use ($userId) { |
|
44 | + function($join) use ($userId) { |
|
45 | 45 | $join |
46 | 46 | ->on('people.id', '=', 'company_person.person_id') |
47 | 47 | ->where('company_person.company_id', $userId) |
48 | 48 | ->where('company_person.is_main', true); |
49 | 49 | } |
50 | - )->leftJoin('companies', function ($join) use ($userId) { |
|
50 | + )->leftJoin('companies', function($join) use ($userId) { |
|
51 | 51 | $join->on('company_person.company_id', '=', 'companies.id') |
52 | 52 | ->where('companies.id', $userId); |
53 | 53 | }); |
@@ -12,10 +12,10 @@ |
||
12 | 12 | |
13 | 13 | public function query(): Builder |
14 | 14 | { |
15 | - return Family::leftJoin('people as husband', function ($join) { |
|
15 | + return Family::leftJoin('people as husband', function($join) { |
|
16 | 16 | $join->on('husband.id', '=', 'families.husband_id'); |
17 | 17 | }) |
18 | - ->leftJoin('people as wife', function ($join) { |
|
18 | + ->leftJoin('people as wife', function($join) { |
|
19 | 19 | $join->on('wife.id', '=', 'families.wife_id'); |
20 | 20 | }) |
21 | 21 | ->select(\DB::raw(' |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | $recordsSince = TenantPerson::orderBy('updated_at', 'desc')->first()?->updated_at; |
34 | 34 | $this->info('Tenant people records syncronization since: '.($recordsSince ?: 'start')); |
35 | 35 | |
36 | - tenancy()->query()->cursor()->each(function (Tenant $tenant) use ($recordsSince) { |
|
36 | + tenancy()->query()->cursor()->each(function(Tenant $tenant) use ($recordsSince) { |
|
37 | 37 | try { |
38 | 38 | tenancy()->initialize($tenant); |
39 | 39 | |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | } |
45 | 45 | |
46 | 46 | $this->info('Processing tenant #'.$tenant->id.' records: '.(clone $tenantPersonQuery)->count()); |
47 | - $tenantPersonQuery->chunk(100, function ($people) use ($tenant) { |
|
47 | + $tenantPersonQuery->chunk(100, function($people) use ($tenant) { |
|
48 | 48 | // clear old records and push updated ones |
49 | 49 | TenantPerson::where('tenant_id', $tenant->id) |
50 | 50 | ->whereIn('tenant_person_id', $people->pluck('id')) |
@@ -36,7 +36,7 @@ |
||
36 | 36 | public function handle() |
37 | 37 | { |
38 | 38 | $p_id = $this->user->person_id; // person_id |
39 | - $f_id = 0; // family_id |
|
39 | + $f_id = 0; // family_id |
|
40 | 40 | |
41 | 41 | $tenant = Manager::fromModel($this->user->company(), $this->user); |
42 | 42 | $tenant->connect(); |
@@ -30,7 +30,7 @@ |
||
30 | 30 | throw_unless(File::isFile($this->filePath), \Exception::class, "{$this->filePath} does not exist."); |
31 | 31 | |
32 | 32 | $tenant = Manager::fromModel($this->user->company(), $this->user); |
33 | - if (! $tenant->databaseExists()) { |
|
33 | + if (!$tenant->databaseExists()) { |
|
34 | 34 | //$tenant->dropDatabase(); |
35 | 35 | $tenant->createDatabase(); |
36 | 36 | $tenant->connect(); |
@@ -20,7 +20,7 @@ |
||
20 | 20 | |
21 | 21 | try { |
22 | 22 | $user->createAsStripeCustomer(); |
23 | - } catch(\Exception $e) { |
|
23 | + } catch (\Exception $e) { |
|
24 | 24 | } |
25 | 25 | |
26 | 26 | $couponCode = $request->input('coupon_code'); |
@@ -9,7 +9,7 @@ |
||
9 | 9 | { |
10 | 10 | public function getConnectionName() |
11 | 11 | { |
12 | - if (! App::runningUnitTests() && Auth::check()) { |
|
12 | + if (!App::runningUnitTests() && Auth::check()) { |
|
13 | 13 | $user = \Auth::user(); |
14 | 14 | $role_id = $user->role_id; |
15 | 15 | if ($user->isAdmin()) { |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | public function redirectToProvider($provider) |
55 | 55 | { |
56 | 56 | $validated = $this->validateProvider($provider); |
57 | - if (! is_null($validated)) { |
|
57 | + if (!is_null($validated)) { |
|
58 | 58 | return $validated; |
59 | 59 | } |
60 | 60 | |
@@ -77,7 +77,7 @@ discard block |
||
77 | 77 | |
78 | 78 | $curUser = User::where('email', $user->getEmail())->first(); |
79 | 79 | |
80 | - if (! $curUser) { |
|
80 | + if (!$curUser) { |
|
81 | 81 | try { |
82 | 82 | // create person |
83 | 83 | $person = new Person(); |
@@ -150,7 +150,7 @@ discard block |
||
150 | 150 | |
151 | 151 | public function needsToCreateSocial(User $user, $service) |
152 | 152 | { |
153 | - return ! $user->hasSocialLinked($service); |
|
153 | + return !$user->hasSocialLinked($service); |
|
154 | 154 | } |
155 | 155 | |
156 | 156 | public function unique_random($table, $col, $chars = 16) |
@@ -186,7 +186,7 @@ discard block |
||
186 | 186 | // If unique is still false at this point |
187 | 187 | // it will just repeat all the steps until |
188 | 188 | // it has generated a random string of characters |
189 | - } while (! $unique); |
|
189 | + } while (!$unique); |
|
190 | 190 | |
191 | 191 | return $random; |
192 | 192 | } |
@@ -210,7 +210,7 @@ discard block |
||
210 | 210 | { |
211 | 211 | $this->user = $this->loggableUser($request); |
212 | 212 | |
213 | - if (! $this->user) { |
|
213 | + if (!$this->user) { |
|
214 | 214 | return false; |
215 | 215 | } |
216 | 216 | |
@@ -260,7 +260,7 @@ discard block |
||
260 | 260 | 'password' => 'required|string', |
261 | 261 | ]; |
262 | 262 | |
263 | - if (! $request->attributes->get('sanctum')) { |
|
263 | + if (!$request->attributes->get('sanctum')) { |
|
264 | 264 | $attributes['device_name'] = 'required|string'; |
265 | 265 | } |
266 | 266 | |
@@ -273,7 +273,7 @@ discard block |
||
273 | 273 | */ |
274 | 274 | protected function validateProvider($provider) |
275 | 275 | { |
276 | - if (! in_array($provider, ['facebook', 'google', 'github'])) { |
|
276 | + if (!in_array($provider, ['facebook', 'google', 'github'])) { |
|
277 | 277 | return response()->json(['error' => 'Please login using facebook or google or github'], 422); |
278 | 278 | } |
279 | 279 | } |
@@ -310,11 +310,11 @@ discard block |
||
310 | 310 | { |
311 | 311 | $user = User::whereEmail($request->input('email'))->first(); |
312 | 312 | |
313 | - if (! optional($user)->currentPasswordIs($request->input('password'))) { |
|
313 | + if (!optional($user)->currentPasswordIs($request->input('password'))) { |
|
314 | 314 | return; |
315 | 315 | } |
316 | 316 | |
317 | - if (! $user->email) { |
|
317 | + if (!$user->email) { |
|
318 | 318 | throw ValidationException::withMessages([ |
319 | 319 | 'email' => 'Email does not exist.', |
320 | 320 | ]); |
@@ -331,7 +331,7 @@ discard block |
||
331 | 331 | ]); |
332 | 332 | } |
333 | 333 | |
334 | - if (! App::runningUnitTests()) { |
|
334 | + if (!App::runningUnitTests()) { |
|
335 | 335 | $company = $user->person->company(); |
336 | 336 | // \Log::debug('Login----------------------'.$company); |
337 | 337 | $tenant = false; |
@@ -340,25 +340,25 @@ discard block |
||
340 | 340 | } |
341 | 341 | // set company id as default |
342 | 342 | $main_company = $user->person->company(); |
343 | - if ($main_company !== null && ! $user->isAdmin()) { |
|
343 | + if ($main_company !== null && !$user->isAdmin()) { |
|
344 | 344 | $c_id = $main_company->id; |
345 | 345 | } |
346 | - if (! $user->isAdmin()) { |
|
346 | + if (!$user->isAdmin()) { |
|
347 | 347 | $tenants = Tenant::find($main_company->id); |
348 | 348 | } |
349 | 349 | if ($user->isAdmin()) { |
350 | 350 | $tenants = null; |
351 | 351 | } |
352 | - if ($main_company === null && ! $user->isAdmin()) { |
|
352 | + if ($main_company === null && !$user->isAdmin()) { |
|
353 | 353 | // if (($main_company == null||$tenants=='') && ! $user->isAdmin()) { |
354 | 354 | // if ($main_company == null) { |
355 | 355 | $this->create_company($user); |
356 | - } elseif ($tenants && ! $user->isAdmin()) { |
|
356 | + } elseif ($tenants && !$user->isAdmin()) { |
|
357 | 357 | // $c = DB::connection('tenantdb',$tenants->tenancy_db_name)->table('users')->count(); |
358 | 358 | $company = \App\Models\Company::find($main_company->id); |
359 | 359 | // \Log::debug('Database----------------------'.$main_company->id); |
360 | 360 | tenancy()->initialize($tenants); |
361 | - $tenants->run(function () use ($company, $user) { |
|
361 | + $tenants->run(function() use ($company, $user) { |
|
362 | 362 | // $company->save(); |
363 | 363 | $c = User::count(); |
364 | 364 | if ($c === 0) { |
@@ -385,11 +385,11 @@ discard block |
||
385 | 385 | } |
386 | 386 | // set company id as default |
387 | 387 | $main_company = $user->person->company(); |
388 | - if ($main_company !== null && ! $user->isAdmin()) { |
|
388 | + if ($main_company !== null && !$user->isAdmin()) { |
|
389 | 389 | $c_id = $main_company->id.$user->id; |
390 | 390 | } |
391 | 391 | |
392 | - if ($main_company === null && ! $user->isAdmin()) { |
|
392 | + if ($main_company === null && !$user->isAdmin()) { |
|
393 | 393 | // if ($main_company == null) { |
394 | 394 | $this->create_company($user); |
395 | 395 | } |
@@ -81,7 +81,7 @@ |
||
81 | 81 | ]; |
82 | 82 | foreach ($partners as $partner) { |
83 | 83 | $p = Person::find($partner); |
84 | - if (isset($p) && ! isset($this->persons[$partner])) { |
|
84 | + if (isset($p) && !isset($this->persons[$partner])) { |
|
85 | 85 | $this->persons[$partner] = $p; |
86 | 86 | } |
87 | 87 | } |