@@ -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 | \Core::oauthClients()->revokeAccessToken($token); |
| 41 | 41 | }); |
| 42 | 42 | } |
@@ -65,7 +65,7 @@ discard block |
||
| 65 | 65 | $permissions = []; |
| 66 | 66 | $user = $this->repo->find(\Auth::id(), $relations); |
| 67 | 67 | foreach ($user->roles as $role) { |
| 68 | - $role->permissions->each(function ($permission) use (&$permissions) { |
|
| 68 | + $role->permissions->each(function($permission) use (&$permissions) { |
|
| 69 | 69 | $permissions[$permission->repo][$permission->id] = $permission->name; |
| 70 | 70 | }); |
| 71 | 71 | } |
@@ -128,7 +128,7 @@ discard block |
||
| 128 | 128 | public function assignRoles($userId, $roleIds) |
| 129 | 129 | { |
| 130 | 130 | $user = false; |
| 131 | - \DB::transaction(function () use ($userId, $permissionIds, &$user) { |
|
| 131 | + \DB::transaction(function() use ($userId, $permissionIds, &$user) { |
|
| 132 | 132 | $user = $this->repo->find($userId); |
| 133 | 133 | $this->repo->detachPermissions($userId); |
| 134 | 134 | $this->repo->attachPermissions($userId, $roleIds); |
@@ -147,15 +147,15 @@ discard block |
||
| 147 | 147 | */ |
| 148 | 148 | public function login($email, $password, $adminLogin = false) |
| 149 | 149 | { |
| 150 | - if (! $user = $this->repo->first(['email' => $email])) { |
|
| 150 | + if ( ! $user = $this->repo->first(['email' => $email])) { |
|
| 151 | 151 | \Errors::loginFailed(); |
| 152 | 152 | } elseif ($adminLogin && ! $this->hasRoles(['Admin'], $user)) { |
| 153 | 153 | \Errors::loginFailed(); |
| 154 | - } elseif (! $adminLogin && $this->hasRoles(['Admin'], $user)) { |
|
| 154 | + } elseif ( ! $adminLogin && $this->hasRoles(['Admin'], $user)) { |
|
| 155 | 155 | \Errors::loginFailed(); |
| 156 | 156 | } elseif ($user->blocked) { |
| 157 | 157 | \Errors::userIsBlocked(); |
| 158 | - } elseif (! config('skeleton.disable_confirm_email') && ! $user->confirmed) { |
|
| 158 | + } elseif ( ! config('skeleton.disable_confirm_email') && ! $user->confirmed) { |
|
| 159 | 159 | \Errors::emailNotConfirmed(); |
| 160 | 160 | } |
| 161 | 161 | |
@@ -175,11 +175,11 @@ discard block |
||
| 175 | 175 | $access_token = $authCode ? Arr::get(\Socialite::driver($type)->getAccessTokenResponse($authCode), 'access_token') : $accessToken; |
| 176 | 176 | $user = \Socialite::driver($type)->userFromToken($access_token); |
| 177 | 177 | |
| 178 | - if (! $user->email) { |
|
| 178 | + if ( ! $user->email) { |
|
| 179 | 179 | \Errors::noSocialEmail(); |
| 180 | 180 | } |
| 181 | 181 | |
| 182 | - if (! $this->repo->first(['email' => $user->email])) { |
|
| 182 | + if ( ! $this->repo->first(['email' => $user->email])) { |
|
| 183 | 183 | $this->register(['email' => $user->email, 'password' => ''], true); |
| 184 | 184 | } |
| 185 | 185 | |
@@ -204,7 +204,7 @@ discard block |
||
| 204 | 204 | 'confirmed' => $skipConfirmEmail |
| 205 | 205 | ]); |
| 206 | 206 | |
| 207 | - if (! $skipConfirmEmail && ! config('skeleton.disable_confirm_email')) { |
|
| 207 | + if ( ! $skipConfirmEmail && ! config('skeleton.disable_confirm_email')) { |
|
| 208 | 208 | $this->sendConfirmationEmail($user->email); |
| 209 | 209 | } |
| 210 | 210 | |
@@ -245,7 +245,7 @@ discard block |
||
| 245 | 245 | */ |
| 246 | 246 | public function sendReset($email) |
| 247 | 247 | { |
| 248 | - if (! $user = $this->repo->first(['email' => $email])) { |
|
| 248 | + if ( ! $user = $this->repo->first(['email' => $email])) { |
|
| 249 | 249 | \Errors::notFound('email'); |
| 250 | 250 | } |
| 251 | 251 | |
@@ -269,7 +269,7 @@ discard block |
||
| 269 | 269 | 'password' => $password, |
| 270 | 270 | 'password_confirmation' => $passwordConfirmation, |
| 271 | 271 | 'token' => $token |
| 272 | - ], function ($user, $password) { |
|
| 272 | + ], function($user, $password) { |
|
| 273 | 273 | $this->repo->save(['id' => $user->id, 'password' => $password]); |
| 274 | 274 | }); |
| 275 | 275 | |
@@ -306,7 +306,7 @@ discard block |
||
| 306 | 306 | public function changePassword($password, $oldPassword) |
| 307 | 307 | { |
| 308 | 308 | $user = \Auth::user(); |
| 309 | - if (! \Hash::check($oldPassword, $user->password)) { |
|
| 309 | + if ( ! \Hash::check($oldPassword, $user->password)) { |
|
| 310 | 310 | \Errors::invalidOldPassword(); |
| 311 | 311 | } |
| 312 | 312 | |
@@ -321,7 +321,7 @@ discard block |
||
| 321 | 321 | */ |
| 322 | 322 | public function confirmEmail($confirmationCode) |
| 323 | 323 | { |
| 324 | - if (! $user = $this->repo->first(['confirmation_code' => $confirmationCode])) { |
|
| 324 | + if ( ! $user = $this->repo->first(['confirmation_code' => $confirmationCode])) { |
|
| 325 | 325 | \Errors::invalidConfirmationCode(); |
| 326 | 326 | } |
| 327 | 327 | |
@@ -43,9 +43,9 @@ |
||
| 43 | 43 | /** |
| 44 | 44 | * Check report existance and permission. |
| 45 | 45 | */ |
| 46 | - if (! $report) { |
|
| 46 | + if ( ! $report) { |
|
| 47 | 47 | \Errors::notFound('report'); |
| 48 | - } elseif (! $skipPermission && ! $this->userService->can($report->view_name, 'report')) { |
|
| 48 | + } elseif ( ! $skipPermission && ! $this->userService->can($report->view_name, 'report')) { |
|
| 49 | 49 | \Errors::noPermissions(); |
| 50 | 50 | } |
| 51 | 51 | |
@@ -19,7 +19,7 @@ discard block |
||
| 19 | 19 | */ |
| 20 | 20 | public function __construct($model) |
| 21 | 21 | { |
| 22 | - $this->model = $model; |
|
| 22 | + $this->model = $model; |
|
| 23 | 23 | } |
| 24 | 24 | |
| 25 | 25 | /** |
@@ -84,7 +84,7 @@ discard block |
||
| 84 | 84 | $model = false; |
| 85 | 85 | $relations = []; |
| 86 | 86 | |
| 87 | - \DB::transaction(function () use (&$model, $relations, $data) { |
|
| 87 | + \DB::transaction(function() use (&$model, $relations, $data) { |
|
| 88 | 88 | |
| 89 | 89 | $model = $this->prepareModel($data); |
| 90 | 90 | $relations = $this->prepareRelations($data, $model); |
@@ -104,8 +104,8 @@ discard block |
||
| 104 | 104 | */ |
| 105 | 105 | public function delete($value, $attribute = 'id') |
| 106 | 106 | { |
| 107 | - \DB::transaction(function () use ($value, $attribute) { |
|
| 108 | - $this->model->where($attribute, '=', $value)->lockForUpdate()->get()->each(function ($model) { |
|
| 107 | + \DB::transaction(function() use ($value, $attribute) { |
|
| 108 | + $this->model->where($attribute, '=', $value)->lockForUpdate()->get()->each(function($model) { |
|
| 109 | 109 | $model->delete(); |
| 110 | 110 | }); |
| 111 | 111 | }); |
@@ -195,7 +195,7 @@ discard block |
||
| 195 | 195 | { |
| 196 | 196 | $model = $this->model->onlyTrashed()->find($id); |
| 197 | 197 | |
| 198 | - if (! $model) { |
|
| 198 | + if ( ! $model) { |
|
| 199 | 199 | \Errors::notFound(class_basename($this->model).' with id : '.$id); |
| 200 | 200 | } |
| 201 | 201 | |
@@ -219,7 +219,7 @@ discard block |
||
| 219 | 219 | * @var array |
| 220 | 220 | */ |
| 221 | 221 | $model = Arr::has($data, 'id') ? $modelClass->lockForUpdate()->find($data['id']) : new $modelClass; |
| 222 | - if (! $model) { |
|
| 222 | + if ( ! $model) { |
|
| 223 | 223 | \Errors::notFound(class_basename($modelClass).' with id : '.$data['id']); |
| 224 | 224 | } |
| 225 | 225 | |
@@ -269,7 +269,7 @@ discard block |
||
| 269 | 269 | * If the relation has no value then marke the relation data |
| 270 | 270 | * related to the model to be deleted. |
| 271 | 271 | */ |
| 272 | - if (! $value || ! count($value)) { |
|
| 272 | + if ( ! $value || ! count($value)) { |
|
| 273 | 273 | $relations[$relation] = 'delete'; |
| 274 | 274 | } |
| 275 | 275 | } |
@@ -296,7 +296,7 @@ discard block |
||
| 296 | 296 | /** |
| 297 | 297 | * If model doesn't exists. |
| 298 | 298 | */ |
| 299 | - if (! $relationModel) { |
|
| 299 | + if ( ! $relationModel) { |
|
| 300 | 300 | \Errors::notFound(class_basename($relationBaseModel).' with id : '.$val['id']); |
| 301 | 301 | } |
| 302 | 302 | |
@@ -327,7 +327,7 @@ discard block |
||
| 327 | 327 | /** |
| 328 | 328 | * If model doesn't exists. |
| 329 | 329 | */ |
| 330 | - if (! $relationModel) { |
|
| 330 | + if ( ! $relationModel) { |
|
| 331 | 331 | \Errors::notFound(class_basename($relationBaseModel).' with id : '.$value['id']); |
| 332 | 332 | } |
| 333 | 333 | |
@@ -533,7 +533,7 @@ discard block |
||
| 533 | 533 | $value = $removeLast === false ? $value : substr($value, 0, $removeLast); |
| 534 | 534 | $path = explode('->', $value); |
| 535 | 535 | $field = array_shift($path); |
| 536 | - $result = sprintf('%s->\'$.%s\'', $field, collect($path)->map(function ($part) { |
|
| 536 | + $result = sprintf('%s->\'$.%s\'', $field, collect($path)->map(function($part) { |
|
| 537 | 537 | return '"'.$part.'"'; |
| 538 | 538 | })->implode('.')); |
| 539 | 539 | |