@@ -63,7 +63,7 @@ |
||
63 | 63 | return \Response::json(['errors' => [$errors]], $exception->getStatusCode()); |
64 | 64 | } elseif ($exception instanceof \Illuminate\Validation\ValidationException) { |
65 | 65 | return \Response::json(['errors' => $exception->errors()], 422); |
66 | - } elseif (! $exception instanceof \Symfony\Component\ErrorHandler\Error\FatalError) { |
|
66 | + } elseif ( ! $exception instanceof \Symfony\Component\ErrorHandler\Error\FatalError) { |
|
67 | 67 | return parent::render($request, $exception); |
68 | 68 | } |
69 | 69 | } |
@@ -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', ['notification', 'pushNotificationDevice'])->each(function ($permission) use ($adminGroupId) { |
|
21 | + \DB::table('permissions')->orderBy('created_at', 'asc')->whereIn('model', ['notification', 'pushNotificationDevice'])->each(function($permission) use ($adminGroupId) { |
|
22 | 22 | \DB::table('groups_permissions')->insert( |
23 | 23 | [ |
24 | 24 | 'permission_id' => $permission->id, |
@@ -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', ['report'])->each(function ($permission) use ($adminGroupId) { |
|
21 | + \DB::table('permissions')->orderBy('created_at', 'asc')->whereIn('model', ['report'])->each(function($permission) use ($adminGroupId) { |
|
22 | 22 | \DB::table('groups_permissions')->insert( |
23 | 23 | [ |
24 | 24 | 'permission_id' => $permission->id, |
@@ -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. |
@@ -216,14 +216,14 @@ discard block |
||
216 | 216 | $modelClass = $this->model; |
217 | 217 | $relations = []; |
218 | 218 | |
219 | - \DB::transaction(function () use (&$model, &$relations, $data, $modelClass) { |
|
219 | + \DB::transaction(function() use (&$model, &$relations, $data, $modelClass) { |
|
220 | 220 | /** |
221 | 221 | * If the id is present in the data then select the model for updating, |
222 | 222 | * else create new model. |
223 | 223 | * @var array |
224 | 224 | */ |
225 | 225 | $model = Arr::has($data, 'id') ? $modelClass->lockForUpdate()->find($data['id']) : new $modelClass; |
226 | - if (! $model) { |
|
226 | + if ( ! $model) { |
|
227 | 227 | \ErrorHandler::notFound(class_basename($modelClass).' with id : '.$data['id']); |
228 | 228 | } |
229 | 229 | |
@@ -246,7 +246,7 @@ discard block |
||
246 | 246 | * If the relation has no value then marke the relation data |
247 | 247 | * related to the model to be deleted. |
248 | 248 | */ |
249 | - if (! $value || ! count($value)) { |
|
249 | + if ( ! $value || ! count($value)) { |
|
250 | 250 | $relations[$relation] = 'delete'; |
251 | 251 | } |
252 | 252 | } |
@@ -273,7 +273,7 @@ discard block |
||
273 | 273 | /** |
274 | 274 | * If model doesn't exists. |
275 | 275 | */ |
276 | - if (! $relationModel) { |
|
276 | + if ( ! $relationModel) { |
|
277 | 277 | \ErrorHandler::notFound(class_basename($relationBaseModel).' with id : '.$val['id']); |
278 | 278 | } |
279 | 279 | |
@@ -304,7 +304,7 @@ discard block |
||
304 | 304 | /** |
305 | 305 | * If model doesn't exists. |
306 | 306 | */ |
307 | - if (! $relationModel) { |
|
307 | + if ( ! $relationModel) { |
|
308 | 308 | \ErrorHandler::notFound(class_basename($relationBaseModel).' with id : '.$value['id']); |
309 | 309 | } |
310 | 310 | |
@@ -437,17 +437,17 @@ discard block |
||
437 | 437 | public function delete($value, $attribute = 'id') |
438 | 438 | { |
439 | 439 | if ($attribute == 'id') { |
440 | - \DB::transaction(function () use ($value) { |
|
440 | + \DB::transaction(function() use ($value) { |
|
441 | 441 | $model = $this->model->lockForUpdate()->find($value); |
442 | - if (! $model) { |
|
442 | + if ( ! $model) { |
|
443 | 443 | \ErrorHandler::notFound(class_basename($this->model).' with id : '.$value); |
444 | 444 | } |
445 | 445 | |
446 | 446 | $model->delete(); |
447 | 447 | }); |
448 | 448 | } else { |
449 | - \DB::transaction(function () use ($value, $attribute) { |
|
450 | - $this->model->where($attribute, '=', $value)->lockForUpdate()->get()->each(function ($model) { |
|
449 | + \DB::transaction(function() use ($value, $attribute) { |
|
450 | + $this->model->where($attribute, '=', $value)->lockForUpdate()->get()->each(function($model) { |
|
451 | 451 | $model->delete(); |
452 | 452 | }); |
453 | 453 | }); |
@@ -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 |
@@ -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', ['setting'])->each(function ($permission) use ($adminGroupId) { |
|
21 | + \DB::table('permissions')->orderBy('created_at', 'asc')->whereIn('model', ['setting'])->each(function($permission) use ($adminGroupId) { |
|
22 | 22 | \DB::table('groups_permissions')->insert( |
23 | 23 | [ |
24 | 24 | 'permission_id' => $permission->id, |
@@ -36,7 +36,7 @@ |
||
36 | 36 | public function updated($model) |
37 | 37 | { |
38 | 38 | if ($model->isDirty('blocked') && $model->blocked) { |
39 | - $model->tokens()->each(function ($token) { |
|
39 | + $model->tokens()->each(function($token) { |
|
40 | 40 | |
41 | 41 | \Core::users()->revokeAccessToken($token); |
42 | 42 | }); |
@@ -13,7 +13,7 @@ discard block |
||
13 | 13 | | |
14 | 14 | */ |
15 | 15 | |
16 | -Route::group(['prefix' => 'users'], function () { |
|
16 | +Route::group(['prefix' => 'users'], function() { |
|
17 | 17 | |
18 | 18 | Route::get('/', 'UserController@index'); |
19 | 19 | Route::get('/{id}', 'UserController@find'); |
@@ -27,7 +27,7 @@ discard block |
||
27 | 27 | Route::post('assign/groups', 'UserController@assignGroups'); |
28 | 28 | Route::post('group/{groupName}', 'UserController@group'); |
29 | 29 | |
30 | - Route::group(['prefix' => 'account'], function () { |
|
30 | + Route::group(['prefix' => 'account'], function() { |
|
31 | 31 | |
32 | 32 | Route::get('my', 'UserController@account'); |
33 | 33 | Route::get('logout', 'UserController@logout'); |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | Route::group([ |
55 | 55 | 'middleware' => 'web', |
56 | 56 | 'namespace' => $this->namespace, |
57 | - ], function ($router) { |
|
57 | + ], function($router) { |
|
58 | 58 | require module_path('users', 'Routes/web.php', 'app'); |
59 | 59 | }); |
60 | 60 | } |
@@ -72,7 +72,7 @@ discard block |
||
72 | 72 | 'middleware' => 'api', |
73 | 73 | 'namespace' => $this->namespace, |
74 | 74 | 'prefix' => 'api', |
75 | - ], function ($router) { |
|
75 | + ], function($router) { |
|
76 | 76 | require module_path('users', 'Routes/api.php', 'app'); |
77 | 77 | }); |
78 | 78 | } |
@@ -1,6 +1,6 @@ |
||
1 | 1 | <?php |
2 | 2 | |
3 | -$factory->define(App\Modules\Users\AclUser::class, function (Faker\Generator $faker) { |
|
3 | +$factory->define(App\Modules\Users\AclUser::class, function(Faker\Generator $faker) { |
|
4 | 4 | return [ |
5 | 5 | 'profile_picture' => 'http://lorempixel.com/400/200/', |
6 | 6 | 'name' => $faker->name(), |