@@ -3,9 +3,6 @@ |
||
| 3 | 3 | namespace App\Modules\PushNotificationDevices\Services; |
| 4 | 4 | |
| 5 | 5 | use App\Modules\Core\BaseClasses\BaseService; |
| 6 | -use LaravelFCM\Message\OptionsBuilder; |
|
| 7 | -use LaravelFCM\Message\PayloadDataBuilder; |
|
| 8 | -use LaravelFCM\Message\PayloadNotificationBuilder; |
|
| 9 | 6 | use App\Modules\PushNotificationDevices\Repositories\PushNotificationDeviceRepository; |
| 10 | 7 | |
| 11 | 8 | class PushNotificationDeviceService extends BaseService |
@@ -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 | |