@@ -17,7 +17,7 @@ |
||
17 | 17 | $this->loadViewsFrom(__DIR__.'/../Resources/Views', 'users'); |
18 | 18 | |
19 | 19 | $this->loadMigrationsFrom(module_path('users', 'Database/Migrations', 'app')); |
20 | - if (!$this->app->configurationIsCached()) { |
|
20 | + if ( ! $this->app->configurationIsCached()) { |
|
21 | 21 | $this->loadConfigsFrom(module_path('users', 'Config', 'app')); |
22 | 22 | } |
23 | 23 | } |
@@ -18,7 +18,7 @@ discard block |
||
18 | 18 | */ |
19 | 19 | public function toArray($request) |
20 | 20 | { |
21 | - if (! $this->resource) { |
|
21 | + if ( ! $this->resource) { |
|
22 | 22 | return []; |
23 | 23 | } |
24 | 24 | |
@@ -31,7 +31,7 @@ discard block |
||
31 | 31 | 'readNotifications' => NotificationResource::collection($this->whenLoaded('readNotifications')), |
32 | 32 | 'unreadNotifications' => NotificationResource::collection($this->whenLoaded('unreadNotifications')), |
33 | 33 | 'roles' => RoleResource::collection($this->whenLoaded('roles')), |
34 | - 'permissions' => $this->when($this->permissions, function () { |
|
34 | + 'permissions' => $this->when($this->permissions, function() { |
|
35 | 35 | return PermissionResource::collection($this->permissions); |
36 | 36 | }), |
37 | 37 | 'oauthClients' => OauthClientResource::collection($this->whenLoaded('oauthClients')), |
@@ -67,7 +67,7 @@ discard block |
||
67 | 67 | $permissions = []; |
68 | 68 | $user = $this->repo->find(\Auth::id(), $relations); |
69 | 69 | foreach ($user->roles as $role) { |
70 | - $role->permissions->each(function ($permission) use (&$permissions) { |
|
70 | + $role->permissions->each(function($permission) use (&$permissions) { |
|
71 | 71 | $permissions[] = $permission; |
72 | 72 | }); |
73 | 73 | } |
@@ -130,7 +130,7 @@ discard block |
||
130 | 130 | public function assignRoles($userId, $roleIds) |
131 | 131 | { |
132 | 132 | $user = false; |
133 | - \DB::transaction(function () use ($userId, $roleIds, &$user) { |
|
133 | + \DB::transaction(function() use ($userId, $roleIds, &$user) { |
|
134 | 134 | $user = $this->repo->find($userId); |
135 | 135 | $this->repo->detachRoles($user); |
136 | 136 | $this->repo->attachRoles($user, $roleIds); |
@@ -148,11 +148,11 @@ discard block |
||
148 | 148 | */ |
149 | 149 | public function login($email, $password) |
150 | 150 | { |
151 | - if (! $user = $this->repo->first(['email' => $email])) { |
|
151 | + if ( ! $user = $this->repo->first(['email' => $email])) { |
|
152 | 152 | \Errors::loginFailed(); |
153 | 153 | } elseif ($user->blocked) { |
154 | 154 | \Errors::userIsBlocked(); |
155 | - } elseif (! config('user.disable_confirm_email') && ! $user->confirmed) { |
|
155 | + } elseif ( ! config('user.disable_confirm_email') && ! $user->confirmed) { |
|
156 | 156 | \Errors::emailNotConfirmed(); |
157 | 157 | } |
158 | 158 | |
@@ -171,11 +171,11 @@ discard block |
||
171 | 171 | $accessToken = $authCode ? Arr::get(\Socialite::driver($type)->getAccessTokenResponse($authCode), 'access_token') : $accessToken; |
172 | 172 | $user = \Socialite::driver($type)->userFromToken($accessToken)->user; |
173 | 173 | |
174 | - if (! Arr::has($user, 'email')) { |
|
174 | + if ( ! Arr::has($user, 'email')) { |
|
175 | 175 | \Errors::noSocialEmail(); |
176 | 176 | } |
177 | 177 | |
178 | - if (! $this->repo->first(['email' => $user['email']]) && ! $this->repo->deleted(['email' => $user['email']])->count()) { |
|
178 | + if ( ! $this->repo->first(['email' => $user['email']]) && ! $this->repo->deleted(['email' => $user['email']])->count()) { |
|
179 | 179 | $this->register(Arr::get($user, 'name'), $user['email'], '', true); |
180 | 180 | } |
181 | 181 | |
@@ -193,13 +193,13 @@ discard block |
||
193 | 193 | { |
194 | 194 | $data['confirmed'] = $skipConfirmEmail; |
195 | 195 | |
196 | - if($roleId){ |
|
196 | + if ($roleId) { |
|
197 | 197 | $data ['roles'] = [['id' => $roleId]]; |
198 | 198 | } |
199 | 199 | |
200 | 200 | $user = $this->repo->save($data); |
201 | 201 | |
202 | - if (! $skipConfirmEmail && ! config('user.disable_confirm_email')) { |
|
202 | + if ( ! $skipConfirmEmail && ! config('user.disable_confirm_email')) { |
|
203 | 203 | $this->sendConfirmationEmail($user->email); |
204 | 204 | } |
205 | 205 | |
@@ -240,7 +240,7 @@ discard block |
||
240 | 240 | */ |
241 | 241 | public function sendReset($email) |
242 | 242 | { |
243 | - if (! $user = $this->repo->first(['email' => $email])) { |
|
243 | + if ( ! $user = $this->repo->first(['email' => $email])) { |
|
244 | 244 | \Errors::notFound('email'); |
245 | 245 | } |
246 | 246 | |
@@ -264,7 +264,7 @@ discard block |
||
264 | 264 | 'password' => $password, |
265 | 265 | 'password_confirmation' => $passwordConfirmation, |
266 | 266 | 'token' => $token |
267 | - ], function ($user, $password) { |
|
267 | + ], function($user, $password) { |
|
268 | 268 | $this->repo->save(['id' => $user->id, 'password' => $password]); |
269 | 269 | }); |
270 | 270 | |
@@ -297,7 +297,7 @@ discard block |
||
297 | 297 | public function changePassword($password, $oldPassword) |
298 | 298 | { |
299 | 299 | $user = \Auth::user(); |
300 | - if (! \Hash::check($oldPassword, $user->password)) { |
|
300 | + if ( ! \Hash::check($oldPassword, $user->password)) { |
|
301 | 301 | \Errors::invalidOldPassword(); |
302 | 302 | } |
303 | 303 | |
@@ -312,7 +312,7 @@ discard block |
||
312 | 312 | */ |
313 | 313 | public function confirmEmail($confirmationCode) |
314 | 314 | { |
315 | - if (! $user = $this->repo->first(['confirmation_code' => $confirmationCode])) { |
|
315 | + if ( ! $user = $this->repo->first(['confirmation_code' => $confirmationCode])) { |
|
316 | 316 | \Errors::invalidConfirmationCode(); |
317 | 317 | } |
318 | 318 |
@@ -11,7 +11,7 @@ |
||
11 | 11 | | |
12 | 12 | */ |
13 | 13 | |
14 | -Route::group(['prefix' => 'users'], function () { |
|
14 | +Route::group(['prefix' => 'users'], function() { |
|
15 | 15 | |
16 | 16 | Route::get('/confirm/email/{token}', 'UserController@confirmEmailPage')->name('confirm_email_page'); |
17 | 17 | Route::get('/reset/password/{token}', 'UserController@resetPasswordPage')->name('reset_password_page'); |
@@ -17,7 +17,7 @@ |
||
17 | 17 | $this->loadViewsFrom(__DIR__.'/../Resources/Views', 'permissions'); |
18 | 18 | |
19 | 19 | $this->loadMigrationsFrom(module_path('permissions', 'Database/Migrations', 'app')); |
20 | - if (!$this->app->configurationIsCached()) { |
|
20 | + if ( ! $this->app->configurationIsCached()) { |
|
21 | 21 | $this->loadConfigsFrom(module_path('permissions', 'Config', 'app')); |
22 | 22 | } |
23 | 23 | } |
@@ -17,7 +17,7 @@ discard block |
||
17 | 17 | $this->loadViewsFrom(__DIR__.'/../Resources/Views', 'core'); |
18 | 18 | |
19 | 19 | $this->loadMigrationsFrom(module_path('core', 'Database/Migrations', 'app')); |
20 | - if (!$this->app->configurationIsCached()) { |
|
20 | + if ( ! $this->app->configurationIsCached()) { |
|
21 | 21 | $this->loadConfigsFrom(module_path('core', 'Config', 'app')); |
22 | 22 | } |
23 | 23 | } |
@@ -30,22 +30,22 @@ discard block |
||
30 | 30 | public function register() |
31 | 31 | { |
32 | 32 | //Bind Core Facade to the Service Container |
33 | - $this->app->singleton('Core', function () { |
|
33 | + $this->app->singleton('Core', function() { |
|
34 | 34 | return new \App\Modules\Core\Core; |
35 | 35 | }); |
36 | 36 | |
37 | 37 | //Bind Errors Facade to the Service Container |
38 | - $this->app->singleton('Errors', function () { |
|
38 | + $this->app->singleton('Errors', function() { |
|
39 | 39 | return new \App\Modules\Core\Errors\Errors; |
40 | 40 | }); |
41 | 41 | |
42 | 42 | //Bind Media Facade to the Service Container |
43 | - $this->app->singleton('Media', function () { |
|
43 | + $this->app->singleton('Media', function() { |
|
44 | 44 | return new \App\Modules\Core\Utl\Media; |
45 | 45 | }); |
46 | 46 | |
47 | 47 | //Bind ApiConsumer Facade to the Service Container |
48 | - $this->app->singleton('ApiConsumer', function () { |
|
48 | + $this->app->singleton('ApiConsumer', function() { |
|
49 | 49 | $app = app(); |
50 | 50 | return new \App\Modules\Core\Utl\ApiConsumer($app, $app['request'], $app['router']); |
51 | 51 | }); |
@@ -56,8 +56,8 @@ discard block |
||
56 | 56 | $permission = $routeActions[1]; |
57 | 57 | |
58 | 58 | $this->auth->shouldUse('api'); |
59 | - if (! in_array($permission, $skipLoginCheck)) { |
|
60 | - $this->authMiddleware->handle($request, function ($request) use ($modelName, $skipPermissionCheck, $permission) { |
|
59 | + if ( ! in_array($permission, $skipLoginCheck)) { |
|
60 | + $this->authMiddleware->handle($request, function($request) use ($modelName, $skipPermissionCheck, $permission) { |
|
61 | 61 | $user = $this->auth->user(); |
62 | 62 | $isPasswordClient = $user->token() ? $user->token()->client->password_client : false; |
63 | 63 | |
@@ -66,7 +66,7 @@ discard block |
||
66 | 66 | } |
67 | 67 | |
68 | 68 | if ($isPasswordClient && (in_array($permission, $skipPermissionCheck) || $this->userService->can($permission, $modelName))) { |
69 | - } elseif (! $isPasswordClient && $user->tokenCan($modelName.'-'.$permission)) { |
|
69 | + } elseif ( ! $isPasswordClient && $user->tokenCan($modelName.'-'.$permission)) { |
|
70 | 70 | } else { |
71 | 71 | \Errors::noPermissions(); |
72 | 72 | } |
@@ -55,7 +55,7 @@ |
||
55 | 55 | { |
56 | 56 | $stringArr = []; |
57 | 57 | collect(self::all())->each(function($item, $key) use (&$stringArr) { |
58 | - $stringArr[] = $key . ': ' . $item; |
|
58 | + $stringArr[] = $key.': '.$item; |
|
59 | 59 | }); |
60 | 60 | |
61 | 61 | return implode(',', $stringArr); |
@@ -58,8 +58,8 @@ |
||
58 | 58 | |
59 | 59 | if ($this->cacheConfig && $this->cacheConfig == 'cache') { |
60 | 60 | $page = \Request::get('page') !== null ? \Request::get('page') : '1'; |
61 | - $cacheKey = $name . $page . \Session::get('locale') . serialize($arguments); |
|
62 | - return $this->cache->tags([$this->cacheTag])->rememberForever($cacheKey, function () use ($arguments, $name) { |
|
61 | + $cacheKey = $name.$page.\Session::get('locale').serialize($arguments); |
|
62 | + return $this->cache->tags([$this->cacheTag])->rememberForever($cacheKey, function() use ($arguments, $name) { |
|
63 | 63 | return call_user_func_array([$this->service, $name], $arguments); |
64 | 64 | }); |
65 | 65 | } elseif ($this->cacheConfig) { |