@@ -25,7 +25,7 @@ |
||
25 | 25 | { |
26 | 26 | return [ |
27 | 27 | 'name' => 'nullable|string', |
28 | - 'email' => 'required|email|unique:users,email,' . $this->route('id'), |
|
28 | + 'email' => 'required|email|unique:users,email,'.$this->route('id'), |
|
29 | 29 | 'password' => 'nullable|min:6' |
30 | 30 | ]; |
31 | 31 | } |
@@ -20,7 +20,7 @@ discard block |
||
20 | 20 | */ |
21 | 21 | Role::updateOrInsert([ |
22 | 22 | 'name' => 'Admin', |
23 | - ],[ |
|
23 | + ], [ |
|
24 | 24 | 'created_at' => \DB::raw('NOW()'), |
25 | 25 | 'updated_at' => \DB::raw('NOW()') |
26 | 26 | ]); |
@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | */ |
31 | 31 | AclUser::updateOrInsert([ |
32 | 32 | 'email' => '[email protected]', |
33 | - ],[ |
|
33 | + ], [ |
|
34 | 34 | 'name' => 'Admin', |
35 | 35 | 'password' => \Hash::make('123456'), |
36 | 36 | 'confirmed' => 1, |
@@ -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->repo][$permission->id] = $permission->name; |
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']])) { |
|
178 | + if ( ! $this->repo->first(['email' => $user['email']])) { |
|
179 | 179 | $this->register($user['name'], $user['email'], '', true); |
180 | 180 | } |
181 | 181 | |
@@ -200,7 +200,7 @@ discard block |
||
200 | 200 | 'confirmed' => $skipConfirmEmail |
201 | 201 | ]); |
202 | 202 | |
203 | - if (! $skipConfirmEmail && ! config('user.disable_confirm_email')) { |
|
203 | + if ( ! $skipConfirmEmail && ! config('user.disable_confirm_email')) { |
|
204 | 204 | $this->sendConfirmationEmail($user->email); |
205 | 205 | } |
206 | 206 | |
@@ -241,7 +241,7 @@ discard block |
||
241 | 241 | */ |
242 | 242 | public function sendReset($email) |
243 | 243 | { |
244 | - if (! $user = $this->repo->first(['email' => $email])) { |
|
244 | + if ( ! $user = $this->repo->first(['email' => $email])) { |
|
245 | 245 | \Errors::notFound('email'); |
246 | 246 | } |
247 | 247 | |
@@ -265,7 +265,7 @@ discard block |
||
265 | 265 | 'password' => $password, |
266 | 266 | 'password_confirmation' => $passwordConfirmation, |
267 | 267 | 'token' => $token |
268 | - ], function ($user, $password) { |
|
268 | + ], function($user, $password) { |
|
269 | 269 | $this->repo->save(['id' => $user->id, 'password' => $password]); |
270 | 270 | }); |
271 | 271 | |
@@ -298,7 +298,7 @@ discard block |
||
298 | 298 | public function changePassword($password, $oldPassword) |
299 | 299 | { |
300 | 300 | $user = \Auth::user(); |
301 | - if (! \Hash::check($oldPassword, $user->password)) { |
|
301 | + if ( ! \Hash::check($oldPassword, $user->password)) { |
|
302 | 302 | \Errors::invalidOldPassword(); |
303 | 303 | } |
304 | 304 | |
@@ -313,7 +313,7 @@ discard block |
||
313 | 313 | */ |
314 | 314 | public function confirmEmail($confirmationCode) |
315 | 315 | { |
316 | - if (! $user = $this->repo->first(['confirmation_code' => $confirmationCode])) { |
|
316 | + if ( ! $user = $this->repo->first(['confirmation_code' => $confirmationCode])) { |
|
317 | 317 | \Errors::invalidConfirmationCode(); |
318 | 318 | } |
319 | 319 |
@@ -24,7 +24,7 @@ |
||
24 | 24 | public function rules() |
25 | 25 | { |
26 | 26 | return [ |
27 | - 'name' => 'required|string|max:100|unique:roles,name,' . $this->route('id') |
|
27 | + 'name' => 'required|string|max:100|unique:roles,name,'.$this->route('id') |
|
28 | 28 | ]; |
29 | 29 | } |
30 | 30 | } |
@@ -28,7 +28,7 @@ |
||
28 | 28 | public function assignPermissions($roleId, $permissionIds) |
29 | 29 | { |
30 | 30 | $role = false; |
31 | - \DB::transaction(function () use ($roleId, $permissionIds, &$role) { |
|
31 | + \DB::transaction(function() use ($roleId, $permissionIds, &$role) { |
|
32 | 32 | $role = $this->repo->find($roleId); |
33 | 33 | $this->repo->detachPermissions($role); |
34 | 34 | $this->repo->attachPermissions($role, $permissionIds); |
@@ -26,7 +26,7 @@ |
||
26 | 26 | */ |
27 | 27 | public function revoke($clientId) |
28 | 28 | { |
29 | - \DB::transaction(function () use ($clientId) { |
|
29 | + \DB::transaction(function() use ($clientId) { |
|
30 | 30 | $client = $this->repo->find($clientId); |
31 | 31 | $this->repo->revokeClientTokens($client); |
32 | 32 | $this->repo->save(['id'=> $clientId, 'revoked' => true]); |
@@ -19,12 +19,12 @@ |
||
19 | 19 | public function __call($name, $arguments) |
20 | 20 | { |
21 | 21 | foreach (\Module::all() as $module) { |
22 | - $nameSpace = 'App\\Modules\\' . $module['basename'] ; |
|
22 | + $nameSpace = 'App\\Modules\\'.$module['basename']; |
|
23 | 23 | $model = ucfirst(\Str::singular($name)); |
24 | - if(count($arguments) == 1 && $arguments[0]) { |
|
25 | - $class = $nameSpace . '\\Services\\' . $model . 'Service'; |
|
24 | + if (count($arguments) == 1 && $arguments[0]) { |
|
25 | + $class = $nameSpace.'\\Services\\'.$model.'Service'; |
|
26 | 26 | } else { |
27 | - $class = $nameSpace . '\\Repositories\\' . $model . 'Repository'; |
|
27 | + $class = $nameSpace.'\\Repositories\\'.$model.'Repository'; |
|
28 | 28 | } |
29 | 29 | |
30 | 30 | if (class_exists($class)) { |
@@ -40,7 +40,7 @@ |
||
40 | 40 | return $values; |
41 | 41 | } |
42 | 42 | |
43 | - if (! $primaryLocale || ! is_object($values) || ! property_exists($values, $primaryLocale)) { |
|
43 | + if ( ! $primaryLocale || ! is_object($values) || ! property_exists($values, $primaryLocale)) { |
|
44 | 44 | return $values ? (isset($values->$fallbackLocale) ? $values->$fallbackLocale : $values) : ''; |
45 | 45 | } |
46 | 46 |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | { |
38 | 38 | $translatable = $this->repo->model->translatable ?? []; |
39 | 39 | $filters = $this->constructFilters($conditions); |
40 | - $sortBy = in_array($sortBy, $translatable) ? $sortBy . '->' . \Session::get('locale') : $sortBy; |
|
40 | + $sortBy = in_array($sortBy, $translatable) ? $sortBy.'->'.\Session::get('locale') : $sortBy; |
|
41 | 41 | |
42 | 42 | if ($trashed) { |
43 | 43 | return $this->deleted(['and' => $filters], $perPage ?? 15, $sortBy ?? 'created_at', $desc ?? true); |
@@ -202,22 +202,22 @@ discard block |
||
202 | 202 | $translatable = $this->repo->model->translatable ?? []; |
203 | 203 | foreach ($conditions as $key => $value) { |
204 | 204 | if ((in_array($key, $this->repo->model->fillable ?? []) || method_exists($this->repo->model, $key) || in_array($key, ['or', 'and'])) && $key !== 'trashed') { |
205 | - $key = in_array($key, $translatable) ? $key . '->' . (\Session::get('locale') == 'all' ? 'en' : \Session::get('locale')) : $key; |
|
205 | + $key = in_array($key, $translatable) ? $key.'->'.(\Session::get('locale') == 'all' ? 'en' : \Session::get('locale')) : $key; |
|
206 | 206 | if (filter_var($value, FILTER_VALIDATE_BOOLEAN, FILTER_NULL_ON_FAILURE) !== null && strpos($key, '_id') === false && ! is_null($value)) { |
207 | 207 | $filters[$key] = filter_var($value, FILTER_VALIDATE_BOOLEAN); |
208 | - } elseif (! is_array($value) && strpos($key, '_id')) { |
|
208 | + } elseif ( ! is_array($value) && strpos($key, '_id')) { |
|
209 | 209 | $filters[$key] = [ |
210 | 210 | 'op' => 'in', |
211 | 211 | 'val' => explode(',', $value) |
212 | 212 | ]; |
213 | 213 | } elseif (is_array($value)) { |
214 | 214 | $filters[$key] = $value; |
215 | - } elseif($value) { |
|
216 | - $key = 'LOWER(' . $key . ')'; |
|
215 | + } elseif ($value) { |
|
216 | + $key = 'LOWER('.$key.')'; |
|
217 | 217 | $value = strtolower($value); |
218 | 218 | $filters[$key] = [ |
219 | 219 | 'op' => 'like', |
220 | - 'val' => '%' . $value . '%' |
|
220 | + 'val' => '%'.$value.'%' |
|
221 | 221 | ]; |
222 | 222 | } |
223 | 223 | } |