@@ -28,7 +28,7 @@ discard block |
||
28 | 28 | $permissions = []; |
29 | 29 | $user = $this->find(\Auth::id(), $relations); |
30 | 30 | foreach ($user->roles()->get() as $role) { |
31 | - $role->permissions->each(function ($permission) use (&$permissions) { |
|
31 | + $role->permissions->each(function($permission) use (&$permissions) { |
|
32 | 32 | $permissions[$permission->model][$permission->id] = $permission->name; |
33 | 33 | }); |
34 | 34 | } |
@@ -51,7 +51,7 @@ discard block |
||
51 | 51 | $user = $user ?: $this->find(\Auth::id(), ['roles.permissions']); |
52 | 52 | $permissions = []; |
53 | 53 | |
54 | - $user->roles->pluck('permissions')->each(function ($permission) use (&$permissions, $model) { |
|
54 | + $user->roles->pluck('permissions')->each(function($permission) use (&$permissions, $model) { |
|
55 | 55 | $permissions = array_merge($permissions, $permission->where('model', $model)->pluck('name')->toArray()); |
56 | 56 | }); |
57 | 57 | |
@@ -80,7 +80,7 @@ discard block |
||
80 | 80 | */ |
81 | 81 | public function assignRoles($userId, $roleIds) |
82 | 82 | { |
83 | - \DB::transaction(function () use ($userId, $roleIds) { |
|
83 | + \DB::transaction(function() use ($userId, $roleIds) { |
|
84 | 84 | $user = $this->find($userId); |
85 | 85 | $user->roles()->detach(); |
86 | 86 | $user->roles()->attach($roleIds); |
@@ -99,15 +99,15 @@ discard block |
||
99 | 99 | */ |
100 | 100 | public function login($credentials, $adminLogin = false) |
101 | 101 | { |
102 | - if (! $user = $this->first(['email' => $credentials['email']])) { |
|
102 | + if ( ! $user = $this->first(['email' => $credentials['email']])) { |
|
103 | 103 | \ErrorHandler::loginFailed(); |
104 | 104 | } elseif ($adminLogin && ! $user->roles->whereIn('name', ['Admin'])->count()) { |
105 | 105 | \ErrorHandler::loginFailed(); |
106 | - } elseif (! $adminLogin && $user->roles->whereIn('name', ['Admin'])->count()) { |
|
106 | + } elseif ( ! $adminLogin && $user->roles->whereIn('name', ['Admin'])->count()) { |
|
107 | 107 | \ErrorHandler::loginFailed(); |
108 | 108 | } elseif ($user->blocked) { |
109 | 109 | \ErrorHandler::userIsBlocked(); |
110 | - } elseif (! config('skeleton.disable_confirm_email') && ! $user->confirmed) { |
|
110 | + } elseif ( ! config('skeleton.disable_confirm_email') && ! $user->confirmed) { |
|
111 | 111 | \ErrorHandler::emailNotConfirmed(); |
112 | 112 | } |
113 | 113 | |
@@ -127,11 +127,11 @@ discard block |
||
127 | 127 | $access_token = $authCode ? Arr::get(\Socialite::driver($type)->getAccessTokenResponse($authCode), 'access_token') : $accessToken; |
128 | 128 | $user = \Socialite::driver($type)->userFromToken($access_token); |
129 | 129 | |
130 | - if (! $user->email) { |
|
130 | + if ( ! $user->email) { |
|
131 | 131 | \ErrorHandler::noSocialEmail(); |
132 | 132 | } |
133 | 133 | |
134 | - if (! $this->model->where('email', $user->email)->first()) { |
|
134 | + if ( ! $this->model->where('email', $user->email)->first()) { |
|
135 | 135 | $this->register(['email' => $user->email, 'password' => ''], true); |
136 | 136 | } |
137 | 137 | |
@@ -153,7 +153,7 @@ discard block |
||
153 | 153 | if ($skipConfirmEmail) { |
154 | 154 | $user->confirmed = 1; |
155 | 155 | $user->save(); |
156 | - } elseif (! config('skeleton.disable_confirm_email')) { |
|
156 | + } elseif ( ! config('skeleton.disable_confirm_email')) { |
|
157 | 157 | $this->sendConfirmationEmail($user->email); |
158 | 158 | } |
159 | 159 | |
@@ -168,10 +168,10 @@ discard block |
||
168 | 168 | */ |
169 | 169 | public function block($userId) |
170 | 170 | { |
171 | - if (! $user = $this->find($userId)) { |
|
171 | + if ( ! $user = $this->find($userId)) { |
|
172 | 172 | \ErrorHandler::notFound('user'); |
173 | 173 | } |
174 | - if (! $this->hasRole(['Admin'])) { |
|
174 | + if ( ! $this->hasRole(['Admin'])) { |
|
175 | 175 | \ErrorHandler::noPermissions(); |
176 | 176 | } elseif (\Auth::id() == $userId) { |
177 | 177 | \ErrorHandler::noPermissions(); |
@@ -193,7 +193,7 @@ discard block |
||
193 | 193 | */ |
194 | 194 | public function unblock($userId) |
195 | 195 | { |
196 | - if (! $this->hasRole(['Admin'])) { |
|
196 | + if ( ! $this->hasRole(['Admin'])) { |
|
197 | 197 | \ErrorHandler::noPermissions(); |
198 | 198 | } |
199 | 199 | |
@@ -212,7 +212,7 @@ discard block |
||
212 | 212 | */ |
213 | 213 | public function sendReset($email) |
214 | 214 | { |
215 | - if (! $user = $this->model->where('email', $email)->first()) { |
|
215 | + if ( ! $user = $this->model->where('email', $email)->first()) { |
|
216 | 216 | \ErrorHandler::notFound('email'); |
217 | 217 | } |
218 | 218 | |
@@ -236,7 +236,7 @@ discard block |
||
236 | 236 | 'password' => $password, |
237 | 237 | 'password_confirmation' => $passwordConfirmation, |
238 | 238 | 'token' => $token |
239 | - ], function ($user, $password) { |
|
239 | + ], function($user, $password) { |
|
240 | 240 | $user->password = $password; |
241 | 241 | $user->save(); |
242 | 242 | }); |
@@ -272,7 +272,7 @@ discard block |
||
272 | 272 | public function changePassword($password, $oldPassword) |
273 | 273 | { |
274 | 274 | $user = \Auth::user(); |
275 | - if (! \Hash::check($oldPassword, $user->password)) { |
|
275 | + if ( ! \Hash::check($oldPassword, $user->password)) { |
|
276 | 276 | \ErrorHandler::invalidOldPassword(); |
277 | 277 | } |
278 | 278 | |
@@ -288,7 +288,7 @@ discard block |
||
288 | 288 | */ |
289 | 289 | public function confirmEmail($confirmationCode) |
290 | 290 | { |
291 | - if (! $user = $this->first(['confirmation_code' => $confirmationCode])) { |
|
291 | + if ( ! $user = $this->first(['confirmation_code' => $confirmationCode])) { |
|
292 | 292 | \ErrorHandler::invalidConfirmationCode(); |
293 | 293 | } |
294 | 294 | |
@@ -333,7 +333,7 @@ discard block |
||
333 | 333 | $sort = $desc ? 'desc' : 'asc'; |
334 | 334 | $model = $this->model->with($relations); |
335 | 335 | |
336 | - $model->whereHas('roles', function ($q) use ($roleName) { |
|
336 | + $model->whereHas('roles', function($q) use ($roleName) { |
|
337 | 337 | $q->where('name', $roleName); |
338 | 338 | }); |
339 | 339 |
@@ -201,7 +201,7 @@ |
||
201 | 201 | */ |
202 | 202 | public function changePassword(ChangePassword $request) |
203 | 203 | { |
204 | - return new GeneralResource($this->repo->changePassword($request->get('password') , $request->get('old_password'))); |
|
204 | + return new GeneralResource($this->repo->changePassword($request->get('password'), $request->get('old_password'))); |
|
205 | 205 | } |
206 | 206 | |
207 | 207 | /** |