@@ -18,7 +18,7 @@ |
||
18 | 18 | /** |
19 | 19 | * Assign the permissions to the admin group. |
20 | 20 | */ |
21 | - \DB::table('permissions')->orderBy('created_at', 'asc')->whereIn('model', ['settings'])->each(function ($permission) use ($adminGroupId) { |
|
21 | + \DB::table('permissions')->orderBy('created_at', 'asc')->whereIn('model', ['settings'])->each(function($permission) use ($adminGroupId) { |
|
22 | 22 | \DB::table('groups_permissions')->insert( |
23 | 23 | [ |
24 | 24 | 'permission_id' => $permission->id, |
@@ -83,7 +83,7 @@ |
||
83 | 83 | if ($this->cacheConfig && $this->cacheConfig == 'cache') { |
84 | 84 | $page = \Request::get('page') !== null ? \Request::get('page') : '1'; |
85 | 85 | $cacheKey = $name.$page.\Session::get('locale').serialize($arguments); |
86 | - return $this->cache->tags([$this->cacheTag])->rememberForever($cacheKey, function () use ($arguments, $name) { |
|
86 | + return $this->cache->tags([$this->cacheTag])->rememberForever($cacheKey, function() use ($arguments, $name) { |
|
87 | 87 | return call_user_func_array([$this->repo, $name], $arguments); |
88 | 88 | }); |
89 | 89 | } elseif ($this->cacheConfig) { |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | $this->skipLoginCheck = property_exists($this, 'skipLoginCheck') ? $this->skipLoginCheck : []; |
38 | 38 | $route = explode('@', \Route::currentRouteAction())[1]; |
39 | 39 | |
40 | - $this->middleware(function ($request, $next) { |
|
40 | + $this->middleware(function($request, $next) { |
|
41 | 41 | |
42 | 42 | $this->repo = call_user_func_array("\Core::{$this->model}", []); |
43 | 43 | return $next($request); |
@@ -212,7 +212,7 @@ discard block |
||
212 | 212 | \Auth::shouldUse('api'); |
213 | 213 | $this->middleware('auth:api', ['except' => $this->skipLoginCheck]); |
214 | 214 | |
215 | - if (! in_array($permission, $this->skipLoginCheck) && $user = \Auth::user()) { |
|
215 | + if ( ! in_array($permission, $this->skipLoginCheck) && $user = \Auth::user()) { |
|
216 | 216 | $user = \Auth::user(); |
217 | 217 | $permission = $permission !== 'index' ? $permission : 'list'; |
218 | 218 | $isPasswordClient = $user->token()->client->password_client; |
@@ -223,7 +223,7 @@ discard block |
||
223 | 223 | } |
224 | 224 | |
225 | 225 | if ($isPasswordClient && (in_array($permission, $this->skipPermissionCheck) || \Core::users()->can($permission, $this->model))) { |
226 | - } elseif (! $isPasswordClient && $user->tokenCan($this->model.'-'.$permission)) { |
|
226 | + } elseif ( ! $isPasswordClient && $user->tokenCan($this->model.'-'.$permission)) { |
|
227 | 227 | } else { |
228 | 228 | \ErrorHandler::noPermissions(); |
229 | 229 | } |
@@ -294,7 +294,7 @@ discard block |
||
294 | 294 | |
295 | 295 | if ($timezone && $timezone !== $user->timezone) { |
296 | 296 | $user->timezone = $timezone; |
297 | - $update = true; |
|
297 | + $update = true; |
|
298 | 298 | } |
299 | 299 | |
300 | 300 | if ($update) { |
@@ -28,27 +28,27 @@ |
||
28 | 28 | public function register() |
29 | 29 | { |
30 | 30 | //Bind Core Facade to the IoC Container |
31 | - \App::bind('Core', function () { |
|
31 | + \App::bind('Core', function() { |
|
32 | 32 | return new \App\Modules\Core\Core; |
33 | 33 | }); |
34 | 34 | |
35 | 35 | //Bind ErrorHandler Facade to the IoC Container |
36 | - \App::bind('ErrorHandler', function () { |
|
36 | + \App::bind('ErrorHandler', function() { |
|
37 | 37 | return new \App\Modules\Core\Utl\ErrorHandler; |
38 | 38 | }); |
39 | 39 | |
40 | 40 | //Bind CoreConfig Facade to the IoC Container |
41 | - \App::bind('CoreConfig', function () { |
|
41 | + \App::bind('CoreConfig', function() { |
|
42 | 42 | return new \App\Modules\Core\Utl\CoreConfig; |
43 | 43 | }); |
44 | 44 | |
45 | 45 | //Bind Mpgs Facade to the IoC Container |
46 | - \App::bind('Media', function () { |
|
46 | + \App::bind('Media', function() { |
|
47 | 47 | return new \App\Modules\Core\Utl\Media; |
48 | 48 | }); |
49 | 49 | |
50 | 50 | //Bind Mpgs Facade to the IoC Container |
51 | - \App::bind('ApiConsumer', function () { |
|
51 | + \App::bind('ApiConsumer', function() { |
|
52 | 52 | return new \App\Modules\Core\Utl\ApiConsumer; |
53 | 53 | }); |
54 | 54 |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | */ |
80 | 80 | protected function getRoutes() |
81 | 81 | { |
82 | - return collect(\Route::getRoutes())->map(function ($route) { |
|
82 | + return collect(\Route::getRoutes())->map(function($route) { |
|
83 | 83 | if (strpos($route->uri(), 'api/') !== false) { |
84 | 84 | return [ |
85 | 85 | 'method' => $route->methods()[0], |
@@ -110,7 +110,7 @@ discard block |
||
110 | 110 | ]; |
111 | 111 | |
112 | 112 | |
113 | - if (! $skipLoginCheck || ! in_array($method, $skipLoginCheck)) { |
|
113 | + if ( ! $skipLoginCheck || ! in_array($method, $skipLoginCheck)) { |
|
114 | 114 | $route['headers']['Authorization'] = 'Bearer {token}'; |
115 | 115 | } |
116 | 116 | } |
@@ -24,7 +24,7 @@ |
||
24 | 24 | */ |
25 | 25 | public function uploadImageBas64($image, $dir) |
26 | 26 | { |
27 | - if (! strlen($image)) { |
|
27 | + if ( ! strlen($image)) { |
|
28 | 28 | return null; |
29 | 29 | } |
30 | 30 |
@@ -214,7 +214,7 @@ |
||
214 | 214 | $server = []; |
215 | 215 | |
216 | 216 | foreach ($headers as $headerType => $headerValue) { |
217 | - $headerType = 'HTTP_' . $headerType; |
|
217 | + $headerType = 'HTTP_'.$headerType; |
|
218 | 218 | |
219 | 219 | $server[$headerType] = $headerValue; |
220 | 220 | } |
@@ -11,9 +11,9 @@ |
||
11 | 11 | | |
12 | 12 | */ |
13 | 13 | |
14 | -Route::group(['prefix' => 'core'], function () { |
|
14 | +Route::group(['prefix' => 'core'], function() { |
|
15 | 15 | |
16 | - Route::group(['prefix' => 'settings'], function () { |
|
16 | + Route::group(['prefix' => 'settings'], function() { |
|
17 | 17 | |
18 | 18 | Route::get('list/{sortBy?}/{desc?}', 'SettingsController@index'); |
19 | 19 | Route::get('find/{id}', 'SettingsController@find'); |
@@ -65,7 +65,7 @@ discard block |
||
65 | 65 | /** |
66 | 66 | * Construct the select conditions for the model. |
67 | 67 | */ |
68 | - $model->where(function ($q) use ($query, $conditionColumns, $relations) { |
|
68 | + $model->where(function($q) use ($query, $conditionColumns, $relations) { |
|
69 | 69 | |
70 | 70 | if (count($conditionColumns)) { |
71 | 71 | $column = 'LOWER('.array_shift($conditionColumns).')'; |
@@ -107,9 +107,9 @@ discard block |
||
107 | 107 | /** |
108 | 108 | * Construct the relation condition. |
109 | 109 | */ |
110 | - $q->orWhereHas($relation, function ($subModel) use ($query, $relation) { |
|
110 | + $q->orWhereHas($relation, function($subModel) use ($query, $relation) { |
|
111 | 111 | |
112 | - $subModel->where(function ($q) use ($query, $relation) { |
|
112 | + $subModel->where(function($q) use ($query, $relation) { |
|
113 | 113 | |
114 | 114 | /** |
115 | 115 | * Get columns of the relation. |
@@ -197,14 +197,14 @@ discard block |
||
197 | 197 | $modelClass = $this->model; |
198 | 198 | $relations = []; |
199 | 199 | |
200 | - \DB::transaction(function () use (&$model, &$relations, $data, $modelClass) { |
|
200 | + \DB::transaction(function() use (&$model, &$relations, $data, $modelClass) { |
|
201 | 201 | /** |
202 | 202 | * If the id is present in the data then select the model for updating, |
203 | 203 | * else create new model. |
204 | 204 | * @var array |
205 | 205 | */ |
206 | 206 | $model = Arr::has($data, 'id') ? $modelClass->lockForUpdate()->find($data['id']) : new $modelClass; |
207 | - if (! $model) { |
|
207 | + if ( ! $model) { |
|
208 | 208 | \ErrorHandler::notFound(class_basename($modelClass).' with id : '.$data['id']); |
209 | 209 | } |
210 | 210 | |
@@ -227,7 +227,7 @@ discard block |
||
227 | 227 | * If the relation has no value then marke the relation data |
228 | 228 | * related to the model to be deleted. |
229 | 229 | */ |
230 | - if (! $value || ! count($value)) { |
|
230 | + if ( ! $value || ! count($value)) { |
|
231 | 231 | $relations[$relation] = 'delete'; |
232 | 232 | } |
233 | 233 | } |
@@ -254,7 +254,7 @@ discard block |
||
254 | 254 | /** |
255 | 255 | * If model doesn't exists. |
256 | 256 | */ |
257 | - if (! $relationModel) { |
|
257 | + if ( ! $relationModel) { |
|
258 | 258 | \ErrorHandler::notFound(class_basename($relationBaseModel).' with id : '.$val['id']); |
259 | 259 | } |
260 | 260 | |
@@ -285,7 +285,7 @@ discard block |
||
285 | 285 | /** |
286 | 286 | * If model doesn't exists. |
287 | 287 | */ |
288 | - if (! $relationModel) { |
|
288 | + if ( ! $relationModel) { |
|
289 | 289 | \ErrorHandler::notFound(class_basename($relationBaseModel).' with id : '.$value['id']); |
290 | 290 | } |
291 | 291 | |
@@ -422,7 +422,7 @@ discard block |
||
422 | 422 | $model = $this->model->lockForUpdate()->find($value); |
423 | 423 | $model ? $model->update($data) : 0; |
424 | 424 | } else { |
425 | - call_user_func_array("{$this->getModel()}::where", array($attribute, '=', $value))->lockForUpdate()->get()->each(function ($model) use ($data) { |
|
425 | + call_user_func_array("{$this->getModel()}::where", array($attribute, '=', $value))->lockForUpdate()->get()->each(function($model) use ($data) { |
|
426 | 426 | $model->update($data); |
427 | 427 | }); |
428 | 428 | } |
@@ -439,17 +439,17 @@ discard block |
||
439 | 439 | public function delete($value, $attribute = 'id') |
440 | 440 | { |
441 | 441 | if ($attribute == 'id') { |
442 | - \DB::transaction(function () use ($value, $attribute, &$result) { |
|
442 | + \DB::transaction(function() use ($value, $attribute, &$result) { |
|
443 | 443 | $model = $this->model->lockForUpdate()->find($value); |
444 | - if (! $model) { |
|
444 | + if ( ! $model) { |
|
445 | 445 | \ErrorHandler::notFound(class_basename($this->model).' with id : '.$value); |
446 | 446 | } |
447 | 447 | |
448 | 448 | $model->delete(); |
449 | 449 | }); |
450 | 450 | } else { |
451 | - \DB::transaction(function () use ($value, $attribute, &$result) { |
|
452 | - call_user_func_array("{$this->getModel()}::where", array($attribute, '=', $value))->lockForUpdate()->get()->each(function ($model) { |
|
451 | + \DB::transaction(function() use ($value, $attribute, &$result) { |
|
452 | + call_user_func_array("{$this->getModel()}::where", array($attribute, '=', $value))->lockForUpdate()->get()->each(function($model) { |
|
453 | 453 | $model->delete(); |
454 | 454 | }); |
455 | 455 | }); |
@@ -538,7 +538,7 @@ discard block |
||
538 | 538 | { |
539 | 539 | $model = $this->model->onlyTrashed()->find($id); |
540 | 540 | |
541 | - if (! $model) { |
|
541 | + if ( ! $model) { |
|
542 | 542 | \ErrorHandler::notFound(class_basename($this->model).' with id : '.$id); |
543 | 543 | } |
544 | 544 | |
@@ -621,7 +621,7 @@ discard block |
||
621 | 621 | $value = $removeLast === false ? $value : substr($value, 0, $removeLast); |
622 | 622 | $path = explode('->', $value); |
623 | 623 | $field = array_shift($path); |
624 | - $result = sprintf('%s->\'$.%s\'', $field, collect($path)->map(function ($part) { |
|
624 | + $result = sprintf('%s->\'$.%s\'', $field, collect($path)->map(function($part) { |
|
625 | 625 | return '"'.$part.'"'; |
626 | 626 | })->implode('.')); |
627 | 627 |