@@ -23,9 +23,9 @@ |
||
23 | 23 | */ |
24 | 24 | public function rules() |
25 | 25 | { |
26 | - $requiredOrNullable = request()->isMethod('PATCH') ? 'nullable' : 'required' . ''; |
|
26 | + $requiredOrNullable = request()->isMethod('PATCH') ? 'nullable' : 'required'.''; |
|
27 | 27 | return [ |
28 | - 'name' => $requiredOrNullable . '|string|max:100|unique:roles,name,' . $this->route('id') |
|
28 | + 'name' => $requiredOrNullable.'|string|max:100|unique:roles,name,'.$this->route('id') |
|
29 | 29 | ]; |
30 | 30 | } |
31 | 31 | } |
@@ -23,11 +23,11 @@ |
||
23 | 23 | */ |
24 | 24 | public function rules() |
25 | 25 | { |
26 | - $requiredOrNullable = request()->isMethod('PATCH') ? 'nullable' : 'required' . ''; |
|
26 | + $requiredOrNullable = request()->isMethod('PATCH') ? 'nullable' : 'required'.''; |
|
27 | 27 | return [ |
28 | - 'name' => $requiredOrNullable . '|max:255', |
|
29 | - 'redirect' => $requiredOrNullable . '|url', |
|
30 | - 'user_id' => $requiredOrNullable . '|exists:users,id', |
|
28 | + 'name' => $requiredOrNullable.'|max:255', |
|
29 | + 'redirect' => $requiredOrNullable.'|url', |
|
30 | + 'user_id' => $requiredOrNullable.'|exists:users,id', |
|
31 | 31 | 'revoked' => 'boolean' |
32 | 32 | ]; |
33 | 33 | } |
@@ -23,10 +23,10 @@ |
||
23 | 23 | */ |
24 | 24 | public function rules() |
25 | 25 | { |
26 | - $requiredOrNullable = request()->isMethod('PATCH') ? 'nullable' : 'required' . ''; |
|
26 | + $requiredOrNullable = request()->isMethod('PATCH') ? 'nullable' : 'required'.''; |
|
27 | 27 | return [ |
28 | 28 | 'name' => 'nullable|string', |
29 | - 'email' => $requiredOrNullable . '|email|unique:users,email,' . $this->route('id'), |
|
29 | + 'email' => $requiredOrNullable.'|email|unique:users,email,'.$this->route('id'), |
|
30 | 30 | 'password' => 'nullable|min:6' |
31 | 31 | ]; |
32 | 32 | } |
@@ -23,10 +23,10 @@ |
||
23 | 23 | */ |
24 | 24 | public function rules() |
25 | 25 | { |
26 | - $requiredOrNullable = request()->isMethod('PATCH') ? 'nullable' : 'required' . ''; |
|
26 | + $requiredOrNullable = request()->isMethod('PATCH') ? 'nullable' : 'required'.''; |
|
27 | 27 | return [ |
28 | - 'device_token' => $requiredOrNullable . '|string|max:255', |
|
29 | - 'user_id' => $requiredOrNullable . '|exists:users,id' |
|
28 | + 'device_token' => $requiredOrNullable.'|string|max:255', |
|
29 | + 'user_id' => $requiredOrNullable.'|exists:users,id' |
|
30 | 30 | ]; |
31 | 31 | } |
32 | 32 | } |
@@ -38,7 +38,7 @@ discard block |
||
38 | 38 | { |
39 | 39 | $translatable = $this->repo->model->translatable ?? []; |
40 | 40 | $filters = $this->constructFilters($conditions); |
41 | - $sortBy = in_array($sortBy, $translatable) ? $sortBy . '->' . Session::get('locale') : $sortBy; |
|
41 | + $sortBy = in_array($sortBy, $translatable) ? $sortBy.'->'.Session::get('locale') : $sortBy; |
|
42 | 42 | |
43 | 43 | if ($trashed) { |
44 | 44 | return $this->deleted(['and' => $filters], $perPage ?? 15, $sortBy ?? 'created_at', $desc ?? true); |
@@ -206,7 +206,7 @@ discard block |
||
206 | 206 | /** |
207 | 207 | * Prepare key based on the the requested lang if it was translatable. |
208 | 208 | */ |
209 | - $key = in_array($key, $translatable) ? $key . '->' . (Session::get('locale') == 'all' ? 'en' : Session::get('locale')) : $key; |
|
209 | + $key = in_array($key, $translatable) ? $key.'->'.(Session::get('locale') == 'all' ? 'en' : Session::get('locale')) : $key; |
|
210 | 210 | |
211 | 211 | /** |
212 | 212 | * Convert 0/1 or true/false to boolean in case of not foreign key. |
@@ -217,7 +217,7 @@ discard block |
||
217 | 217 | /** |
218 | 218 | * Use in operator in case of foreign and comma seperated values. |
219 | 219 | */ |
220 | - } elseif (! is_array($value) && strpos($key, '_id') && $value) { |
|
220 | + } elseif ( ! is_array($value) && strpos($key, '_id') && $value) { |
|
221 | 221 | $filters[$key] = [ |
222 | 222 | 'op' => 'in', |
223 | 223 | 'val' => explode(',', $value) |
@@ -241,11 +241,11 @@ discard block |
||
241 | 241 | * Default string filteration. |
242 | 242 | */ |
243 | 243 | } elseif ($value) { |
244 | - $key = 'LOWER(' . $key . ')'; |
|
244 | + $key = 'LOWER('.$key.')'; |
|
245 | 245 | $value = strtolower($value); |
246 | 246 | $filters[$key] = [ |
247 | 247 | 'op' => 'like', |
248 | - 'val' => '%' . $value . '%' |
|
248 | + 'val' => '%'.$value.'%' |
|
249 | 249 | ]; |
250 | 250 | } |
251 | 251 | } |
@@ -21,7 +21,7 @@ discard block |
||
21 | 21 | */ |
22 | 22 | public function __construct($model) |
23 | 23 | { |
24 | - $this->model = $model; |
|
24 | + $this->model = $model; |
|
25 | 25 | } |
26 | 26 | |
27 | 27 | /** |
@@ -82,7 +82,7 @@ discard block |
||
82 | 82 | */ |
83 | 83 | public function count($conditions = false) |
84 | 84 | { |
85 | - if($conditions) { |
|
85 | + if ($conditions) { |
|
86 | 86 | $conditions = $this->constructConditions($conditions, $this->model); |
87 | 87 | return $this->model->whereRaw($conditions['conditionString'], $conditions['conditionValues'])->count(); |
88 | 88 | } |
@@ -116,7 +116,7 @@ discard block |
||
116 | 116 | $model = false; |
117 | 117 | $relations = []; |
118 | 118 | |
119 | - \DB::transaction(function () use (&$model, &$relations, $data) { |
|
119 | + \DB::transaction(function() use (&$model, &$relations, $data) { |
|
120 | 120 | |
121 | 121 | $model = $this->prepareModel($data); |
122 | 122 | $relations = $this->prepareRelations($data, $model); |
@@ -152,8 +152,8 @@ discard block |
||
152 | 152 | */ |
153 | 153 | public function delete($value, $attribute = 'id') |
154 | 154 | { |
155 | - \DB::transaction(function () use ($value, $attribute) { |
|
156 | - $this->model->where($attribute, '=', $value)->lockForUpdate()->get()->each(function ($model) { |
|
155 | + \DB::transaction(function() use ($value, $attribute) { |
|
156 | + $this->model->where($attribute, '=', $value)->lockForUpdate()->get()->each(function($model) { |
|
157 | 157 | $model->delete(); |
158 | 158 | }); |
159 | 159 | }); |
@@ -243,7 +243,7 @@ discard block |
||
243 | 243 | { |
244 | 244 | $model = $this->model->onlyTrashed()->find($id); |
245 | 245 | |
246 | - if (! $model) { |
|
246 | + if ( ! $model) { |
|
247 | 247 | \Errors::notFound(class_basename($this->model).' with id : '.$id); |
248 | 248 | } |
249 | 249 | |
@@ -267,7 +267,7 @@ discard block |
||
267 | 267 | * @var array |
268 | 268 | */ |
269 | 269 | $model = Arr::has($data, 'id') ? $modelClass->lockForUpdate()->find($data['id']) : new $modelClass; |
270 | - if (! $model) { |
|
270 | + if ( ! $model) { |
|
271 | 271 | \Errors::notFound(class_basename($modelClass).' with id : '.$data['id']); |
272 | 272 | } |
273 | 273 | |
@@ -324,7 +324,7 @@ discard block |
||
324 | 324 | * If the relation has no value then marke the relation data |
325 | 325 | * related to the model to be deleted. |
326 | 326 | */ |
327 | - if (! $value || ! count($value)) { |
|
327 | + if ( ! $value || ! count($value)) { |
|
328 | 328 | $relations[$relation] = 'delete'; |
329 | 329 | } |
330 | 330 | } |
@@ -342,7 +342,7 @@ discard block |
||
342 | 342 | * Check if the relation is a collection. |
343 | 343 | */ |
344 | 344 | if (class_basename($model->$relation) == 'Collection') { |
345 | - if (! is_array($val)) { |
|
345 | + if ( ! is_array($val)) { |
|
346 | 346 | $relationModel = $relationBaseModel->lockForUpdate()->find($val); |
347 | 347 | } else { |
348 | 348 | /** |
@@ -355,7 +355,7 @@ discard block |
||
355 | 355 | /** |
356 | 356 | * If model doesn't exists. |
357 | 357 | */ |
358 | - if (! $relationModel) { |
|
358 | + if ( ! $relationModel) { |
|
359 | 359 | \Errors::notFound(class_basename($relationBaseModel).' with id : '.$val['id']); |
360 | 360 | } |
361 | 361 | |
@@ -393,7 +393,7 @@ discard block |
||
393 | 393 | /** |
394 | 394 | * If model doesn't exists. |
395 | 395 | */ |
396 | - if (! $relationModel) { |
|
396 | + if ( ! $relationModel) { |
|
397 | 397 | \Errors::notFound(class_basename($relationBaseModel).' with id : '.$value['id']); |
398 | 398 | } |
399 | 399 | |
@@ -579,7 +579,7 @@ discard block |
||
579 | 579 | } elseif (strtolower($operator) == 'has') { |
580 | 580 | $sql = $model->withTrashed()->withoutGlobalScopes()->has($key)->toSql(); |
581 | 581 | $bindings = $model->withTrashed()->withoutGlobalScopes()->has($key)->getBindings(); |
582 | - if($value) { |
|
582 | + if ($value) { |
|
583 | 583 | $conditions = $this->constructConditions($value, $model->$key()->getRelated()); |
584 | 584 | $conditionString .= substr(substr($sql, strpos($sql, 'exists')), 0, -1).' and '.$conditions['conditionString'].') {op} '; |
585 | 585 | $conditionValues = array_merge($conditionValues, $bindings); |
@@ -610,7 +610,7 @@ discard block |
||
610 | 610 | $value = $removeLast === false ? $value : substr($value, 0, $removeLast); |
611 | 611 | $path = explode('->', $value); |
612 | 612 | $field = array_shift($path); |
613 | - $result = sprintf('%s->\'$.%s\'', $field, collect($path)->map(function ($part) { |
|
613 | + $result = sprintf('%s->\'$.%s\'', $field, collect($path)->map(function($part) { |
|
614 | 614 | return '"'.$part.'"'; |
615 | 615 | })->implode('.')); |
616 | 616 |
@@ -70,25 +70,25 @@ |
||
70 | 70 | protected function getErrorHandlers() |
71 | 71 | { |
72 | 72 | return [ |
73 | - \Illuminate\Auth\AuthenticationException::class => function ($request, $exception) { |
|
73 | + \Illuminate\Auth\AuthenticationException::class => function($request, $exception) { |
|
74 | 74 | Errors::unAuthorized(); |
75 | 75 | }, |
76 | - \Illuminate\Database\QueryException::class => function ($request, $exception) { |
|
76 | + \Illuminate\Database\QueryException::class => function($request, $exception) { |
|
77 | 77 | Errors::dbQueryError(); |
78 | 78 | }, |
79 | - \predis\connection\connectionexception::class => function ($request, $exception) { |
|
79 | + \predis\connection\connectionexception::class => function($request, $exception) { |
|
80 | 80 | Errors::redisNotRunning(); |
81 | 81 | }, |
82 | - \RedisException::class => function ($request, $exception) { |
|
82 | + \RedisException::class => function($request, $exception) { |
|
83 | 83 | Errors::redisNotRunning(); |
84 | 84 | }, |
85 | - \GuzzleHttp\Exception\ClientException::class => function ($request, $exception) { |
|
85 | + \GuzzleHttp\Exception\ClientException::class => function($request, $exception) { |
|
86 | 86 | Errors::connectionError(); |
87 | 87 | }, |
88 | - \Symfony\Component\HttpKernel\Exception\HttpException::class => function ($request, $exception) { |
|
88 | + \Symfony\Component\HttpKernel\Exception\HttpException::class => function($request, $exception) { |
|
89 | 89 | return response()->json(['errors' => [$exception->getStatusCode() === 404 ? ($exception->getMessage() ?: 'not found') : $exception->getMessage()]], $exception->getStatusCode()); |
90 | 90 | }, |
91 | - \Illuminate\Validation\ValidationException::class => function ($request, $exception) { |
|
91 | + \Illuminate\Validation\ValidationException::class => function($request, $exception) { |
|
92 | 92 | return response()->json(['errors' => $exception->errors()], 422); |
93 | 93 | } |
94 | 94 | ]; |
@@ -17,7 +17,7 @@ |
||
17 | 17 | $this->loadViewsFrom(__DIR__.'/../Resources/Views', 'reporting'); |
18 | 18 | |
19 | 19 | $this->loadMigrationsFrom(module_path('reporting', 'Database/Migrations', 'app')); |
20 | - if (!$this->app->configurationIsCached()) { |
|
20 | + if ( ! $this->app->configurationIsCached()) { |
|
21 | 21 | $this->loadConfigsFrom(module_path('reporting', 'Config', 'app')); |
22 | 22 | } |
23 | 23 | } |
@@ -17,7 +17,7 @@ |
||
17 | 17 | $this->loadViewsFrom(__DIR__.'/../Resources/Views', 'roles'); |
18 | 18 | |
19 | 19 | $this->loadMigrationsFrom(module_path('roles', 'Database/Migrations', 'app')); |
20 | - if (!$this->app->configurationIsCached()) { |
|
20 | + if ( ! $this->app->configurationIsCached()) { |
|
21 | 21 | $this->loadConfigsFrom(module_path('roles', 'Config', 'app')); |
22 | 22 | } |
23 | 23 | } |