@@ -13,7 +13,7 @@ |
||
13 | 13 | | |
14 | 14 | */ |
15 | 15 | |
16 | -Route::group(['prefix' => 'roles'], function () { |
|
16 | +Route::group(['prefix' => 'roles'], function() { |
|
17 | 17 | |
18 | 18 | Route::get('/', 'RoleController@index'); |
19 | 19 | Route::get('/{id}', 'RoleController@find'); |
@@ -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 | /** |
@@ -85,7 +85,7 @@ discard block |
||
85 | 85 | /** |
86 | 86 | * Construct the select conditions for the model. |
87 | 87 | */ |
88 | - $model->where(function ($q) use ($query, $conditionColumns, $relations) { |
|
88 | + $model->where(function($q) use ($query, $conditionColumns, $relations) { |
|
89 | 89 | |
90 | 90 | if (count($conditionColumns)) { |
91 | 91 | $column = 'LOWER('.array_shift($conditionColumns).')'; |
@@ -127,9 +127,9 @@ discard block |
||
127 | 127 | /** |
128 | 128 | * Construct the relation condition. |
129 | 129 | */ |
130 | - $q->orWhereHas($relation, function ($subModel) use ($query, $relation) { |
|
130 | + $q->orWhereHas($relation, function($subModel) use ($query, $relation) { |
|
131 | 131 | |
132 | - $subModel->where(function ($q) use ($query, $relation) { |
|
132 | + $subModel->where(function($q) use ($query, $relation) { |
|
133 | 133 | |
134 | 134 | /** |
135 | 135 | * Get columns of the relation. |
@@ -215,7 +215,7 @@ discard block |
||
215 | 215 | $model = false; |
216 | 216 | $relations = []; |
217 | 217 | |
218 | - \DB::transaction(function () use (&$model, $relations, $data) { |
|
218 | + \DB::transaction(function() use (&$model, $relations, $data) { |
|
219 | 219 | |
220 | 220 | $model = $this->prepareModel($data); |
221 | 221 | $relations = $this->prepareRelations($data, $model); |
@@ -236,17 +236,17 @@ discard block |
||
236 | 236 | public function delete($value, $attribute = 'id') |
237 | 237 | { |
238 | 238 | if ($attribute == 'id') { |
239 | - \DB::transaction(function () use ($value) { |
|
239 | + \DB::transaction(function() use ($value) { |
|
240 | 240 | $model = $this->model->lockForUpdate()->find($value); |
241 | - if (! $model) { |
|
241 | + if ( ! $model) { |
|
242 | 242 | \ErrorHandler::notFound(class_basename($this->model).' with id : '.$value); |
243 | 243 | } |
244 | 244 | |
245 | 245 | $model->delete(); |
246 | 246 | }); |
247 | 247 | } else { |
248 | - \DB::transaction(function () use ($value, $attribute) { |
|
249 | - $this->model->where($attribute, '=', $value)->lockForUpdate()->get()->each(function ($model) { |
|
248 | + \DB::transaction(function() use ($value, $attribute) { |
|
249 | + $this->model->where($attribute, '=', $value)->lockForUpdate()->get()->each(function($model) { |
|
250 | 250 | $model->delete(); |
251 | 251 | }); |
252 | 252 | }); |
@@ -337,7 +337,7 @@ discard block |
||
337 | 337 | { |
338 | 338 | $model = $this->model->onlyTrashed()->find($id); |
339 | 339 | |
340 | - if (! $model) { |
|
340 | + if ( ! $model) { |
|
341 | 341 | \ErrorHandler::notFound(class_basename($this->model).' with id : '.$id); |
342 | 342 | } |
343 | 343 | |
@@ -361,7 +361,7 @@ discard block |
||
361 | 361 | * @var array |
362 | 362 | */ |
363 | 363 | $model = Arr::has($data, 'id') ? $modelClass->lockForUpdate()->find($data['id']) : new $modelClass; |
364 | - if (! $model) { |
|
364 | + if ( ! $model) { |
|
365 | 365 | \ErrorHandler::notFound(class_basename($modelClass).' with id : '.$data['id']); |
366 | 366 | } |
367 | 367 | |
@@ -411,7 +411,7 @@ discard block |
||
411 | 411 | * If the relation has no value then marke the relation data |
412 | 412 | * related to the model to be deleted. |
413 | 413 | */ |
414 | - if (! $value || ! count($value)) { |
|
414 | + if ( ! $value || ! count($value)) { |
|
415 | 415 | $relations[$relation] = 'delete'; |
416 | 416 | } |
417 | 417 | } |
@@ -438,7 +438,7 @@ discard block |
||
438 | 438 | /** |
439 | 439 | * If model doesn't exists. |
440 | 440 | */ |
441 | - if (! $relationModel) { |
|
441 | + if ( ! $relationModel) { |
|
442 | 442 | \ErrorHandler::notFound(class_basename($relationBaseModel).' with id : '.$val['id']); |
443 | 443 | } |
444 | 444 | |
@@ -469,7 +469,7 @@ discard block |
||
469 | 469 | /** |
470 | 470 | * If model doesn't exists. |
471 | 471 | */ |
472 | - if (! $relationModel) { |
|
472 | + if ( ! $relationModel) { |
|
473 | 473 | \ErrorHandler::notFound(class_basename($relationBaseModel).' with id : '.$value['id']); |
474 | 474 | } |
475 | 475 | |
@@ -675,7 +675,7 @@ discard block |
||
675 | 675 | $value = $removeLast === false ? $value : substr($value, 0, $removeLast); |
676 | 676 | $path = explode('->', $value); |
677 | 677 | $field = array_shift($path); |
678 | - $result = sprintf('%s->\'$.%s\'', $field, collect($path)->map(function ($part) { |
|
678 | + $result = sprintf('%s->\'$.%s\'', $field, collect($path)->map(function($part) { |
|
679 | 679 | return '"'.$part.'"'; |
680 | 680 | })->implode('.')); |
681 | 681 |
@@ -47,7 +47,7 @@ |
||
47 | 47 | |
48 | 48 | if ($timezone && $timezone !== $user->timezone) { |
49 | 49 | $user->timezone = $timezone; |
50 | - $update = true; |
|
50 | + $update = true; |
|
51 | 51 | } |
52 | 52 | |
53 | 53 | if ($update) { |
@@ -1,6 +1,6 @@ |
||
1 | 1 | <?php |
2 | 2 | |
3 | -$factory->define(App\Modules\Core\Setting::class, function (Faker\Generator $faker) { |
|
3 | +$factory->define(App\Modules\Core\Setting::class, function(Faker\Generator $faker) { |
|
4 | 4 | return [ |
5 | 5 | 'name' => $faker->randomElement(['Company Name', 'Title', 'Header Image']), |
6 | 6 | 'value' => $faker->word(), |
@@ -60,8 +60,8 @@ discard block |
||
60 | 60 | $permission = $routeActions[1]; |
61 | 61 | |
62 | 62 | $this->auth->shouldUse('api'); |
63 | - if (! in_array($permission, $skipLoginCheck)) { |
|
64 | - $this->authMiddleware->handle($request, function ($request) use ($modelName, $skipPermissionCheck, $skipLoginCheck, $permission) { |
|
63 | + if ( ! in_array($permission, $skipLoginCheck)) { |
|
64 | + $this->authMiddleware->handle($request, function($request) use ($modelName, $skipPermissionCheck, $skipLoginCheck, $permission) { |
|
65 | 65 | $user = $this->auth->user(); |
66 | 66 | $isPasswordClient = $user->token()->client->password_client; |
67 | 67 | |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | } |
71 | 71 | |
72 | 72 | if ($isPasswordClient && (in_array($permission, $skipPermissionCheck) || $this->core->users()->can($permission, $modelName))) { |
73 | - } elseif (! $isPasswordClient && $user->tokenCan($modelName.'-'.$permission)) { |
|
73 | + } elseif ( ! $isPasswordClient && $user->tokenCan($modelName.'-'.$permission)) { |
|
74 | 74 | } else { |
75 | 75 | $this->errorHandler->noPermissions(); |
76 | 76 | } |
@@ -83,7 +83,7 @@ discard block |
||
83 | 83 | */ |
84 | 84 | protected function getRoutes() |
85 | 85 | { |
86 | - return collect(\Route::getRoutes())->map(function ($route) { |
|
86 | + return collect(\Route::getRoutes())->map(function($route) { |
|
87 | 87 | if (strpos($route->uri(), 'api/') !== false) { |
88 | 88 | return [ |
89 | 89 | 'method' => $route->methods()[0], |
@@ -114,7 +114,7 @@ discard block |
||
114 | 114 | ]; |
115 | 115 | |
116 | 116 | |
117 | - if (! $skipLoginCheck || ! in_array($method, $skipLoginCheck)) { |
|
117 | + if ( ! $skipLoginCheck || ! in_array($method, $skipLoginCheck)) { |
|
118 | 118 | $route['headers']['Authorization'] = 'Bearer {token}'; |
119 | 119 | } |
120 | 120 | } |
@@ -162,7 +162,7 @@ discard block |
||
162 | 162 | if (count($parameters)) { |
163 | 163 | $className = optional($reflectionMethod->getParameters()[0]->getType())->getName(); |
164 | 164 | if ($className) { |
165 | - $reflectionClass = new \ReflectionClass($className); |
|
165 | + $reflectionClass = new \ReflectionClass($className); |
|
166 | 166 | |
167 | 167 | if ($reflectionClass->hasMethod('rules')) { |
168 | 168 | $reflectionMethod = $reflectionClass->getMethod('rules'); |