@@ -100,7 +100,7 @@ |
||
100 | 100 | /** |
101 | 101 | * @param Validator $validator |
102 | 102 | * @param array $args |
103 | - * @return \Generator|null |
|
103 | + * @return \Generator |
|
104 | 104 | */ |
105 | 105 | public function validate(Validator $validator, array $args = []): ?\Generator |
106 | 106 | { |
@@ -4,7 +4,7 @@ discard block |
||
4 | 4 | * For the full copyright and license information, please view the LICENSE |
5 | 5 | * file that was distributed with this source code. |
6 | 6 | */ |
7 | -declare(strict_types=1); |
|
7 | +declare(strict_types = 1); |
|
8 | 8 | |
9 | 9 | namespace App\GraphQL\Mutations; |
10 | 10 | |
@@ -102,7 +102,7 @@ discard block |
||
102 | 102 | * @param array $args |
103 | 103 | * @return \Generator|null |
104 | 104 | */ |
105 | - public function validate(Validator $validator, array $args = []): ?\Generator |
|
105 | + public function validate(Validator $validator, array $args = []): ? \Generator |
|
106 | 106 | { |
107 | 107 | [$email, $password] = $this->getEmailAndPassword($args); |
108 | 108 |
@@ -9,13 +9,10 @@ |
||
9 | 9 | |
10 | 10 | namespace App\Http\Controllers; |
11 | 11 | |
12 | -use App\Models\User; |
|
13 | 12 | use App\Models\Article; |
14 | 13 | use App\Services\TokenAuth; |
15 | -use Illuminate\Contracts\Events\Dispatcher; |
|
16 | 14 | use Illuminate\Contracts\View\View; |
17 | 15 | use Illuminate\Contracts\Auth\Guard; |
18 | -use Tymon\JWTAuth\Providers\JWT\JWTInterface; |
|
19 | 16 | |
20 | 17 | /** |
21 | 18 | * Class HomeController. |
@@ -10,15 +10,11 @@ |
||
10 | 10 | |
11 | 11 | use App\Models\User; |
12 | 12 | use App\Services\TokenAuth; |
13 | -use Illuminate\Support\Arr; |
|
14 | 13 | use Illuminate\Http\Request; |
15 | 14 | use Illuminate\Http\Response; |
16 | 15 | use Illuminate\Contracts\Auth\Guard; |
17 | -use Tymon\JWTAuth\Exceptions\JWTException; |
|
18 | 16 | use Illuminate\Contracts\Container\Container; |
19 | -use Tymon\JWTAuth\Providers\JWT\JWTInterface; |
|
20 | 17 | use Illuminate\Contracts\Auth\Authenticatable; |
21 | -use Tymon\JWTAuth\Exceptions\TokenExpiredException; |
|
22 | 18 | use Symfony\Component\HttpKernel\Exception\BadRequestHttpException; |
23 | 19 | use Symfony\Component\HttpKernel\Exception\UnprocessableEntityHttpException; |
24 | 20 |
@@ -6,7 +6,7 @@ |
||
6 | 6 | * For the full copyright and license information, please view the LICENSE |
7 | 7 | * file that was distributed with this source code. |
8 | 8 | */ |
9 | -declare(strict_types=1); |
|
9 | +declare(strict_types = 1); |
|
10 | 10 | |
11 | 11 | namespace App\Http\Middleware; |
12 | 12 |
@@ -9,17 +9,13 @@ |
||
9 | 9 | namespace App\Services; |
10 | 10 | |
11 | 11 | use App\Models\User; |
12 | -use Carbon\Carbon; |
|
13 | 12 | use Illuminate\Contracts\Auth\Authenticatable; |
14 | 13 | use Illuminate\Contracts\Auth\Guard; |
15 | -use Illuminate\Contracts\Encryption\DecryptException; |
|
16 | -use Illuminate\Encryption\Encrypter; |
|
17 | 14 | use Illuminate\Support\Arr; |
18 | 15 | use Symfony\Component\HttpKernel\Exception\BadRequestHttpException; |
19 | 16 | use Symfony\Component\HttpKernel\Exception\UnprocessableEntityHttpException; |
20 | 17 | use Tymon\JWTAuth\Exceptions\JWTException; |
21 | 18 | use Tymon\JWTAuth\Exceptions\TokenExpiredException; |
22 | -use Tymon\JWTAuth\Exceptions\TokenInvalidException; |
|
23 | 19 | use Tymon\JWTAuth\Providers\JWT\JWTInterface; |
24 | 20 | |
25 | 21 | /** |
@@ -4,7 +4,7 @@ discard block |
||
4 | 4 | * For the full copyright and license information, please view the LICENSE |
5 | 5 | * file that was distributed with this source code. |
6 | 6 | */ |
7 | -declare(strict_types=1); |
|
7 | +declare(strict_types = 1); |
|
8 | 8 | |
9 | 9 | namespace App\Services; |
10 | 10 | |
@@ -54,9 +54,9 @@ discard block |
||
54 | 54 | * @param string $password |
55 | 55 | * @return Authenticatable |
56 | 56 | */ |
57 | - public function attemptFromEmailAndPassword(string $email, string $password): ?Authenticatable |
|
57 | + public function attemptFromEmailAndPassword(string $email, string $password): ? Authenticatable |
|
58 | 58 | { |
59 | - if (! $this->guard->validate(['email' => $email, 'password' => $password])) { |
|
59 | + if (!$this->guard->validate(['email' => $email, 'password' => $password])) { |
|
60 | 60 | return null; |
61 | 61 | } |
62 | 62 | |
@@ -68,9 +68,9 @@ discard block |
||
68 | 68 | * @param string $password |
69 | 69 | * @return Authenticatable |
70 | 70 | */ |
71 | - public function resolveFromIdAndPassword(int $id, string $password): ?Authenticatable |
|
71 | + public function resolveFromIdAndPassword(int $id, string $password): ? Authenticatable |
|
72 | 72 | { |
73 | - if (! $this->guard->validate(['id' => $id, 'password' => $password])) { |
|
73 | + if (!$this->guard->validate(['id' => $id, 'password' => $password])) { |
|
74 | 74 | return null; |
75 | 75 | } |
76 | 76 | |
@@ -135,14 +135,14 @@ discard block |
||
135 | 135 | } |
136 | 136 | |
137 | 137 | [$id, $password] = [ |
138 | - (int)Arr::get($userInfo, 'user.id'), |
|
138 | + (int) Arr::get($userInfo, 'user.id'), |
|
139 | 139 | Arr::get($userInfo, 'user.password'), |
140 | 140 | ]; |
141 | 141 | |
142 | 142 | if ($id !== 0) { |
143 | 143 | $user = User::where('id', $id)->where('password', $password)->first(); |
144 | 144 | |
145 | - if (! $user) { |
|
145 | + if (!$user) { |
|
146 | 146 | throw new UnprocessableEntityHttpException('Invalid user credentials.'); |
147 | 147 | } |
148 | 148 |
@@ -5,7 +5,7 @@ discard block |
||
5 | 5 | * For the full copyright and license information, please view the LICENSE |
6 | 6 | * file that was distributed with this source code. |
7 | 7 | */ |
8 | -declare(strict_types=1); |
|
8 | +declare(strict_types = 1); |
|
9 | 9 | |
10 | 10 | namespace App\Exceptions; |
11 | 11 | |
@@ -66,7 +66,7 @@ discard block |
||
66 | 66 | { |
67 | 67 | $exception = $this->prepareException($exception); |
68 | 68 | |
69 | - $htmlAccepted = ! $request->ajax() && $request->acceptsHtml(); |
|
69 | + $htmlAccepted = !$request->ajax() && $request->acceptsHtml(); |
|
70 | 70 | |
71 | 71 | if ($htmlAccepted && config('app.debug')) { |
72 | 72 | $whoops = new Run(); |
@@ -75,7 +75,7 @@ discard block |
||
75 | 75 | return $whoops->handleException($exception); |
76 | 76 | } |
77 | 77 | |
78 | - if (! $this->isHttpException($exception)) { |
|
78 | + if (!$this->isHttpException($exception)) { |
|
79 | 79 | $exception = new HttpException(500, $exception->getMessage(), $exception); |
80 | 80 | } |
81 | 81 |
@@ -4,7 +4,7 @@ discard block |
||
4 | 4 | * For the full copyright and license information, please view the LICENSE |
5 | 5 | * file that was distributed with this source code. |
6 | 6 | */ |
7 | -declare(strict_types=1); |
|
7 | +declare(strict_types = 1); |
|
8 | 8 | |
9 | 9 | namespace App\GraphQL\Kernel; |
10 | 10 | |
@@ -58,7 +58,7 @@ discard block |
||
58 | 58 | * @param array $args |
59 | 59 | * @return \Generator|null |
60 | 60 | */ |
61 | - public function validate(Validator $validator, array $args = []): ?\Generator |
|
61 | + public function validate(Validator $validator, array $args = []): ? \Generator |
|
62 | 62 | { |
63 | 63 | return null; |
64 | 64 | } |
@@ -6,7 +6,7 @@ discard block |
||
6 | 6 | * For the full copyright and license information, please view the LICENSE |
7 | 7 | * file that was distributed with this source code. |
8 | 8 | */ |
9 | -declare(strict_types=1); |
|
9 | +declare(strict_types = 1); |
|
10 | 10 | |
11 | 11 | namespace App\GraphQL\Serializers; |
12 | 12 | |
@@ -25,7 +25,7 @@ discard block |
||
25 | 25 | public function toArray($user): array |
26 | 26 | { |
27 | 27 | return [ |
28 | - 'id' => (int)$user->id, |
|
28 | + 'id' => (int) $user->id, |
|
29 | 29 | 'name' => $user->name, |
30 | 30 | 'email' => $user->email, |
31 | 31 | 'avatar' => $user->avatar, |
@@ -4,7 +4,7 @@ |
||
4 | 4 | * For the full copyright and license information, please view the LICENSE |
5 | 5 | * file that was distributed with this source code. |
6 | 6 | */ |
7 | -declare(strict_types=1); |
|
7 | +declare(strict_types = 1); |
|
8 | 8 | |
9 | 9 | namespace App\GraphQL\Mutations; |
10 | 10 |