@@ -9,7 +9,7 @@ |
||
9 | 9 | { |
10 | 10 | public function getConnectionName() |
11 | 11 | { |
12 | - if (! App::runningUnitTests()) { |
|
12 | + if (!App::runningUnitTests()) { |
|
13 | 13 | if (Auth::check()) { |
14 | 14 | $user = \Auth::user(); |
15 | 15 | $role_id = $user->role_id; |
@@ -40,7 +40,7 @@ |
||
40 | 40 | // If unique is still false at this point |
41 | 41 | // it will just repeat all the steps until |
42 | 42 | // it has generated a random string of characters |
43 | - } while (! $unique); |
|
43 | + } while (!$unique); |
|
44 | 44 | |
45 | 45 | return $random; |
46 | 46 | } |
@@ -20,7 +20,7 @@ |
||
20 | 20 | |
21 | 21 | public function initiateEmailActivationApi(User $user) |
22 | 22 | { |
23 | - if (! config('settings.activation') || ! $this->validateEmail($user)) { |
|
23 | + if (!config('settings.activation') || !$this->validateEmail($user)) { |
|
24 | 24 | return true; |
25 | 25 | } |
26 | 26 |
@@ -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(); |
@@ -50,7 +50,7 @@ discard block |
||
50 | 50 | public function redirectToProvider($provider) |
51 | 51 | { |
52 | 52 | $validated = $this->validateProvider($provider); |
53 | - if (! is_null($validated)) { |
|
53 | + if (!is_null($validated)) { |
|
54 | 54 | return $validated; |
55 | 55 | } |
56 | 56 | |
@@ -73,7 +73,7 @@ discard block |
||
73 | 73 | |
74 | 74 | $curUser = User::where('email', $user->getEmail())->first(); |
75 | 75 | |
76 | - if (! $curUser) { |
|
76 | + if (!$curUser) { |
|
77 | 77 | try { |
78 | 78 | // create person |
79 | 79 | $person = new Person(); |
@@ -146,7 +146,7 @@ discard block |
||
146 | 146 | |
147 | 147 | public function needsToCreateSocial(User $user, $service) |
148 | 148 | { |
149 | - return ! $user->hasSocialLinked($service); |
|
149 | + return !$user->hasSocialLinked($service); |
|
150 | 150 | } |
151 | 151 | |
152 | 152 | public function unique_random($table, $col, $chars = 16) |
@@ -182,7 +182,7 @@ discard block |
||
182 | 182 | // If unique is still false at this point |
183 | 183 | // it will just repeat all the steps until |
184 | 184 | // it has generated a random string of characters |
185 | - } while (! $unique); |
|
185 | + } while (!$unique); |
|
186 | 186 | |
187 | 187 | return $random; |
188 | 188 | } |
@@ -206,7 +206,7 @@ discard block |
||
206 | 206 | { |
207 | 207 | $this->user = $this->loggableUser($request); |
208 | 208 | |
209 | - if (! $this->user) { |
|
209 | + if (!$this->user) { |
|
210 | 210 | return false; |
211 | 211 | } |
212 | 212 | |
@@ -256,7 +256,7 @@ discard block |
||
256 | 256 | 'password' => 'required|string', |
257 | 257 | ]; |
258 | 258 | |
259 | - if (! $request->attributes->get('sanctum')) { |
|
259 | + if (!$request->attributes->get('sanctum')) { |
|
260 | 260 | $attributes['device_name'] = 'required|string'; |
261 | 261 | } |
262 | 262 | |
@@ -269,7 +269,7 @@ discard block |
||
269 | 269 | */ |
270 | 270 | protected function validateProvider($provider) |
271 | 271 | { |
272 | - if (! in_array($provider, ['facebook', 'google', 'github'])) { |
|
272 | + if (!in_array($provider, ['facebook', 'google', 'github'])) { |
|
273 | 273 | return response()->json(['error' => 'Please login using facebook or google or github'], 422); |
274 | 274 | } |
275 | 275 | } |
@@ -311,11 +311,11 @@ discard block |
||
311 | 311 | { |
312 | 312 | $user = User::whereEmail($request->input('email'))->first(); |
313 | 313 | |
314 | - if (! optional($user)->currentPasswordIs($request->input('password'))) { |
|
314 | + if (!optional($user)->currentPasswordIs($request->input('password'))) { |
|
315 | 315 | return; |
316 | 316 | } |
317 | 317 | |
318 | - if (! $user->email) { |
|
318 | + if (!$user->email) { |
|
319 | 319 | throw ValidationException::withMessages([ |
320 | 320 | 'email' => 'Email does not exist.', |
321 | 321 | ]); |
@@ -332,7 +332,7 @@ discard block |
||
332 | 332 | ]); |
333 | 333 | } |
334 | 334 | |
335 | - if (! App::runningUnitTests()) { |
|
335 | + if (!App::runningUnitTests()) { |
|
336 | 336 | $company = $user->person->company(); |
337 | 337 | // \Log::debug('Login----------------------'.$company); |
338 | 338 | $tenant = false; |
@@ -341,27 +341,27 @@ discard block |
||
341 | 341 | } |
342 | 342 | // set company id as default |
343 | 343 | $main_company = $user->person->company(); |
344 | - if ($main_company !== null && ! $user->isAdmin()) { |
|
344 | + if ($main_company !== null && !$user->isAdmin()) { |
|
345 | 345 | $c_id = $main_company->id; |
346 | 346 | } |
347 | - if (! $user->isAdmin()) { |
|
347 | + if (!$user->isAdmin()) { |
|
348 | 348 | $tenants = Tenant::find($main_company->id); |
349 | 349 | } |
350 | 350 | if ($user->isAdmin()) { |
351 | 351 | $tenants = null; |
352 | 352 | } |
353 | - if ($main_company === null && ! $user->isAdmin()) { |
|
353 | + if ($main_company === null && !$user->isAdmin()) { |
|
354 | 354 | // if (($main_company == null||$tenants=='') && ! $user->isAdmin()) { |
355 | 355 | // if ($main_company == null) { |
356 | 356 | $this->create_company($user); |
357 | 357 | } else { |
358 | - if ($tenants && ! $user->isAdmin()) { |
|
358 | + if ($tenants && !$user->isAdmin()) { |
|
359 | 359 | // $c = DB::connection('tenantdb',$tenants->tenancy_db_name)->table('users')->count(); |
360 | 360 | $company = \App\Models\Company::find($main_company->id); |
361 | 361 | // \Log::debug('Database----------------------'.$main_company->id); |
362 | 362 | |
363 | 363 | tenancy()->initialize($tenants); |
364 | - $tenants->run(function () use ($company, $user) { |
|
364 | + $tenants->run(function() use ($company, $user) { |
|
365 | 365 | // $company->save(); |
366 | 366 | $c = User::count(); |
367 | 367 | if ($c === 0) { |
@@ -390,11 +390,11 @@ discard block |
||
390 | 390 | } |
391 | 391 | // set company id as default |
392 | 392 | $main_company = $user->person->company(); |
393 | - if ($main_company !== null && ! $user->isAdmin()) { |
|
393 | + if ($main_company !== null && !$user->isAdmin()) { |
|
394 | 394 | $c_id = $main_company->id.$user->id; |
395 | 395 | } |
396 | 396 | |
397 | - if ($main_company === null && ! $user->isAdmin()) { |
|
397 | + if ($main_company === null && !$user->isAdmin()) { |
|
398 | 398 | // if ($main_company == null) { |
399 | 399 | $this->create_company($user); |
400 | 400 | } |