@@ -14,7 +14,7 @@ |
||
14 | 14 | */ |
15 | 15 | public function toArray($request) |
16 | 16 | { |
17 | - if (! $this->resource) { |
|
17 | + if (!$this->resource) { |
|
18 | 18 | return []; |
19 | 19 | } |
20 | 20 |
@@ -91,7 +91,7 @@ discard block |
||
91 | 91 | $this->container['slug'] = Str::slug($this->argument('slug')); |
92 | 92 | $this->container['name'] = Str::studly($this->container['slug']); |
93 | 93 | $this->container['version'] = '1.0'; |
94 | - $this->container['description'] = 'This is the description for the ' . $this->container['name'] . ' module.'; |
|
94 | + $this->container['description'] = 'This is the description for the '.$this->container['name'].' module.'; |
|
95 | 95 | $this->container['location'] = config('modules.default_location'); |
96 | 96 | $this->container['provider'] = config("modules.locations.{$this->container['location']}.provider"); |
97 | 97 | $this->container['basename'] = Str::studly($this->container['slug']); |
@@ -124,7 +124,7 @@ discard block |
||
124 | 124 | |
125 | 125 | $progress->finish(); |
126 | 126 | |
127 | - event($this->container['slug'] . '.module.made'); |
|
127 | + event($this->container['slug'].'.module.made'); |
|
128 | 128 | |
129 | 129 | $this->info("\nModule generated successfully."); |
130 | 130 | } |
@@ -144,7 +144,7 @@ discard block |
||
144 | 144 | } |
145 | 145 | |
146 | 146 | $directory = module_path(null, $this->container['basename'], $location); |
147 | - $source = __DIR__ . '/Stubs/Module'; |
|
147 | + $source = __DIR__.'/Stubs/Module'; |
|
148 | 148 | |
149 | 149 | $this->files->makeDirectory($directory); |
150 | 150 | |
@@ -163,7 +163,7 @@ discard block |
||
163 | 163 | $subPath = str_replace($search, $replace, $subPath); |
164 | 164 | } |
165 | 165 | |
166 | - $filePath = $directory . '/' . $subPath; |
|
166 | + $filePath = $directory.'/'.$subPath; |
|
167 | 167 | |
168 | 168 | // if the file is module.json, replace it with the custom manifest file name |
169 | 169 | if ($file->getFilename() === 'module.json' && $manifest) { |
@@ -178,7 +178,7 @@ discard block |
||
178 | 178 | |
179 | 179 | $dir = dirname($filePath); |
180 | 180 | |
181 | - if (! $this->files->isDirectory($dir)) { |
|
181 | + if (!$this->files->isDirectory($dir)) { |
|
182 | 182 | $this->files->makeDirectory($dir, 0755, true); |
183 | 183 | } |
184 | 184 | |
@@ -213,22 +213,22 @@ discard block |
||
213 | 213 | ]; |
214 | 214 | |
215 | 215 | $replace = [ |
216 | - ucfirst($modelNameSingular) . 'Factory', |
|
216 | + ucfirst($modelNameSingular).'Factory', |
|
217 | 217 | $modelNameSingular, |
218 | 218 | $this->container['slug'], |
219 | 219 | ucfirst($modelName), |
220 | 220 | ucfirst($modelNameSingular), |
221 | - ucfirst($modelName) . 'DatabaseSeeder', |
|
222 | - ucfirst($modelName) . 'TableSeeder', |
|
223 | - ucfirst($modelNameSingular) . 'Controller', |
|
224 | - ucfirst($modelNameSingular) . 'Service', |
|
225 | - ucfirst($modelNameSingular) . 'ServiceInterface', |
|
226 | - ucfirst($modelNameSingular) . 'Repository', |
|
227 | - ucfirst($modelNameSingular) . 'RepositoryInterface', |
|
228 | - ucfirst($modelName) . 'Errors', |
|
229 | - 'Store' . ucfirst($modelNameSingular), |
|
221 | + ucfirst($modelName).'DatabaseSeeder', |
|
222 | + ucfirst($modelName).'TableSeeder', |
|
223 | + ucfirst($modelNameSingular).'Controller', |
|
224 | + ucfirst($modelNameSingular).'Service', |
|
225 | + ucfirst($modelNameSingular).'ServiceInterface', |
|
226 | + ucfirst($modelNameSingular).'Repository', |
|
227 | + ucfirst($modelNameSingular).'RepositoryInterface', |
|
228 | + ucfirst($modelName).'Errors', |
|
229 | + 'Store'.ucfirst($modelNameSingular), |
|
230 | 230 | ucfirst($modelNameSingular), |
231 | - ucfirst($modelNameSingular) . 'Observer', |
|
231 | + ucfirst($modelNameSingular).'Observer', |
|
232 | 232 | Str::snake($modelName), |
233 | 233 | $modelName, |
234 | 234 | ]; |
@@ -252,6 +252,6 @@ discard block |
||
252 | 252 | $modelName = $this->container['slug']; |
253 | 253 | $migrationName = Str::camel($modelName); |
254 | 254 | $migrationName = Str::snake($migrationName); |
255 | - return $this->callSilent('make:module:migration', ['slug' => $modelName, 'name' => 'create_' . $migrationName . '_table']); |
|
255 | + return $this->callSilent('make:module:migration', ['slug' => $modelName, 'name' => 'create_'.$migrationName.'_table']); |
|
256 | 256 | } |
257 | 257 | } |
@@ -32,7 +32,7 @@ |
||
32 | 32 | { |
33 | 33 | $this->call('passport:keys', ['--force' => $this->option('force'), '--length' => $this->option('length')]); |
34 | 34 | $oauthClient = \Core::oauthCLients()->first(['password_client' => 1]); |
35 | - if (! $oauthClient) { |
|
35 | + if (!$oauthClient) { |
|
36 | 36 | $oauthClient = $client->createPasswordGrantClient( |
37 | 37 | null, |
38 | 38 | config('app.name'), |
@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | { |
43 | 43 | $translatable = $this->repo->model->translatable ?? []; |
44 | 44 | $filters = $this->constructFilters($conditions, $local); |
45 | - $sortBy = in_array($sortBy, $translatable) ? $sortBy . '->' . $local : $sortBy; |
|
45 | + $sortBy = in_array($sortBy, $translatable) ? $sortBy.'->'.$local : $sortBy; |
|
46 | 46 | |
47 | 47 | if ($trashed) { |
48 | 48 | return $this->deleted(['and' => $filters], $perPage ?? 15, $sortBy ?? 'created_at', $desc ?? true); |
@@ -213,7 +213,7 @@ discard block |
||
213 | 213 | /** |
214 | 214 | * Prepare key based on the the requested lang if it was translatable. |
215 | 215 | */ |
216 | - $key = in_array($key, $translatable) ? $key . '->' . $local : $key; |
|
216 | + $key = in_array($key, $translatable) ? $key.'->'.$local : $key; |
|
217 | 217 | |
218 | 218 | /** |
219 | 219 | * Convert 0/1 or true/false to boolean in case of not foreign key. |
@@ -248,11 +248,11 @@ discard block |
||
248 | 248 | * Default string filteration. |
249 | 249 | */ |
250 | 250 | } elseif ($value) { |
251 | - $key = 'LOWER(' . $key . ')'; |
|
251 | + $key = 'LOWER('.$key.')'; |
|
252 | 252 | $value = strtolower($value); |
253 | 253 | $filters[$key] = [ |
254 | 254 | 'op' => 'like', |
255 | - 'val' => '%' . $value . '%' |
|
255 | + 'val' => '%'.$value.'%' |
|
256 | 256 | ]; |
257 | 257 | } |
258 | 258 | } |
@@ -55,7 +55,7 @@ |
||
55 | 55 | { |
56 | 56 | $stringArr = []; |
57 | 57 | collect(self::all())->each(function ($item, $key) use (&$stringArr) { |
58 | - $stringArr[] = $key . ': ' . $item; |
|
58 | + $stringArr[] = $key.': '.$item; |
|
59 | 59 | }); |
60 | 60 | |
61 | 61 | return implode(',', $stringArr); |
@@ -248,7 +248,7 @@ discard block |
||
248 | 248 | $model = $this->model->onlyTrashed()->find($id); |
249 | 249 | |
250 | 250 | if (!$model) { |
251 | - Errors::notFound(class_basename($this->model) . ' with id : ' . $id); |
|
251 | + Errors::notFound(class_basename($this->model).' with id : '.$id); |
|
252 | 252 | } |
253 | 253 | |
254 | 254 | $model->restore(); |
@@ -268,7 +268,7 @@ discard block |
||
268 | 268 | $model = Arr::has($data, 'id') ? $modelClass->lockForUpdate()->find($data['id']) : new $modelClass; |
269 | 269 | |
270 | 270 | if (!$model) { |
271 | - Errors::notFound(class_basename($modelClass) . ' with id : ' . $data['id']); |
|
271 | + Errors::notFound(class_basename($modelClass).' with id : '.$data['id']); |
|
272 | 272 | } |
273 | 273 | |
274 | 274 | foreach ($data as $key => $value) { |
@@ -331,7 +331,7 @@ discard block |
||
331 | 331 | } |
332 | 332 | |
333 | 333 | if (!$relatedModel) { |
334 | - Errors::notFound(class_basename($relationBaseModel) . ' with id : ' . $relatedModelData['id']); |
|
334 | + Errors::notFound(class_basename($relationBaseModel).' with id : '.$relatedModelData['id']); |
|
335 | 335 | } |
336 | 336 | |
337 | 337 | if (is_array($relatedModelData)) { |
@@ -401,11 +401,11 @@ discard block |
||
401 | 401 | |
402 | 402 | if ($key == 'and') { |
403 | 403 | $conditions = $this->constructConditions($value, $model); |
404 | - $conditionString .= str_replace('{op}', 'and', $conditions['conditionString']) . ' {op} '; |
|
404 | + $conditionString .= str_replace('{op}', 'and', $conditions['conditionString']).' {op} '; |
|
405 | 405 | $conditionValues = array_merge($conditionValues, $conditions['conditionValues']); |
406 | 406 | } elseif ($key == 'or') { |
407 | 407 | $conditions = $this->constructConditions($value, $model); |
408 | - $conditionString .= str_replace('{op}', 'or', $conditions['conditionString']) . ' {op} '; |
|
408 | + $conditionString .= str_replace('{op}', 'or', $conditions['conditionString']).' {op} '; |
|
409 | 409 | $conditionValues = array_merge($conditionValues, $conditions['conditionValues']); |
410 | 410 | } else { |
411 | 411 | if (is_array($value)) { |
@@ -421,38 +421,38 @@ discard block |
||
421 | 421 | } |
422 | 422 | |
423 | 423 | if (strtolower($operator) == 'between') { |
424 | - $conditionString .= $key . ' >= ? and '; |
|
424 | + $conditionString .= $key.' >= ? and '; |
|
425 | 425 | $conditionValues[] = $value1; |
426 | 426 | |
427 | - $conditionString .= $key . ' <= ? {op} '; |
|
427 | + $conditionString .= $key.' <= ? {op} '; |
|
428 | 428 | $conditionValues[] = $value2; |
429 | 429 | } elseif (strtolower($operator) == 'in') { |
430 | 430 | $conditionValues = array_merge($conditionValues, $value); |
431 | 431 | $inBindingsString = rtrim(str_repeat('?,', count($value)), ','); |
432 | - $conditionString .= $key . ' in (' . rtrim($inBindingsString, ',') . ') {op} '; |
|
432 | + $conditionString .= $key.' in ('.rtrim($inBindingsString, ',').') {op} '; |
|
433 | 433 | } elseif (strtolower($operator) == 'null') { |
434 | - $conditionString .= $key . ' is null {op} '; |
|
434 | + $conditionString .= $key.' is null {op} '; |
|
435 | 435 | } elseif (strtolower($operator) == 'not null') { |
436 | - $conditionString .= $key . ' is not null {op} '; |
|
436 | + $conditionString .= $key.' is not null {op} '; |
|
437 | 437 | } elseif (strtolower($operator) == 'has') { |
438 | 438 | $sql = $model->withTrashed()->withoutGlobalScopes()->has($key)->toSql(); |
439 | 439 | $bindings = $model->withTrashed()->withoutGlobalScopes()->has($key)->getBindings(); |
440 | 440 | if ($value) { |
441 | 441 | $conditions = $this->constructConditions($value, $model->$key()->getRelated()); |
442 | - $conditionString .= substr(substr($sql, strpos($sql, 'exists')), 0, -1) . ' and ' . $conditions['conditionString'] . ') {op} '; |
|
442 | + $conditionString .= substr(substr($sql, strpos($sql, 'exists')), 0, -1).' and '.$conditions['conditionString'].') {op} '; |
|
443 | 443 | $conditionValues = array_merge($conditionValues, $bindings); |
444 | 444 | $conditionValues = array_merge($conditionValues, $conditions['conditionValues']); |
445 | 445 | } else { |
446 | - $conditionString .= substr(substr($sql, strpos($sql, 'exists')), 0, -1) . ') {op} '; |
|
446 | + $conditionString .= substr(substr($sql, strpos($sql, 'exists')), 0, -1).') {op} '; |
|
447 | 447 | $conditionValues = array_merge($conditionValues, $bindings); |
448 | 448 | } |
449 | 449 | } else { |
450 | - $conditionString .= $key . ' ' . $operator . ' ? {op} '; |
|
450 | + $conditionString .= $key.' '.$operator.' ? {op} '; |
|
451 | 451 | $conditionValues[] = $value; |
452 | 452 | } |
453 | 453 | } |
454 | 454 | } |
455 | - $conditionString = '(' . rtrim($conditionString, '{op} ') . ')'; |
|
455 | + $conditionString = '('.rtrim($conditionString, '{op} ').')'; |
|
456 | 456 | return ['conditionString' => $conditionString, 'conditionValues' => $conditionValues]; |
457 | 457 | } |
458 | 458 | |
@@ -469,9 +469,9 @@ discard block |
||
469 | 469 | $path = explode('->', $value); |
470 | 470 | $field = array_shift($path); |
471 | 471 | $result = sprintf('%s->\'$.%s\'', $field, collect($path)->map(function ($part) { |
472 | - return '"' . $part . '"'; |
|
472 | + return '"'.$part.'"'; |
|
473 | 473 | })->implode('.')); |
474 | 474 | |
475 | - return $removeLast === false ? $result : $result . ')'; |
|
475 | + return $removeLast === false ? $result : $result.')'; |
|
476 | 476 | } |
477 | 477 | } |
@@ -17,7 +17,7 @@ |
||
17 | 17 | */ |
18 | 18 | public function toArray($request) |
19 | 19 | { |
20 | - if (! $this->resource) { |
|
20 | + if (!$this->resource) { |
|
21 | 21 | return []; |
22 | 22 | } |
23 | 23 |
@@ -51,7 +51,7 @@ |
||
51 | 51 | |
52 | 52 | $response = \ApiConsumer::post('/oauth/token', $data); |
53 | 53 | |
54 | - if (! $response->isSuccessful()) { |
|
54 | + if (!$response->isSuccessful()) { |
|
55 | 55 | if ($grantType == 'refresh_token') { |
56 | 56 | \Errors::invalidRefreshToken(); |
57 | 57 | } |
@@ -26,7 +26,7 @@ discard block |
||
26 | 26 | */ |
27 | 27 | public function detachRoles(mixed $user): bool |
28 | 28 | { |
29 | - $user = ! filter_var($user, FILTER_VALIDATE_INT) ? $user : $this->find($user); |
|
29 | + $user = !filter_var($user, FILTER_VALIDATE_INT) ? $user : $this->find($user); |
|
30 | 30 | $user->roles()->detach(); |
31 | 31 | |
32 | 32 | return true; |
@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | */ |
42 | 42 | public function attachRoles(mixed $user, array $roleIds): bool |
43 | 43 | { |
44 | - $user = ! filter_var($user, FILTER_VALIDATE_INT) ? $user : $this->find($user); |
|
44 | + $user = !filter_var($user, FILTER_VALIDATE_INT) ? $user : $this->find($user); |
|
45 | 45 | $user->roles()->attach($roleIds); |
46 | 46 | |
47 | 47 | return true; |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | */ |
57 | 57 | public function countRoles(mixed $user, array $roles): int |
58 | 58 | { |
59 | - $user = ! filter_var($user, FILTER_VALIDATE_INT) ? $user : $this->find($user); |
|
59 | + $user = !filter_var($user, FILTER_VALIDATE_INT) ? $user : $this->find($user); |
|
60 | 60 | return $user->roles()->whereIn('name', $roles)->count(); |
61 | 61 | } |
62 | 62 | } |