@@ -45,9 +45,9 @@ |
||
45 | 45 | |
46 | 46 | public function __invoke(ResetRequest $request): JsonResponse |
47 | 47 | { |
48 | - $credentials = $request->only(['token', 'email', 'password', 'password_confirmation']); |
|
48 | + $credentials = $request->only([ 'token', 'email', 'password', 'password_confirmation' ]); |
|
49 | 49 | |
50 | - $response = $this->getPasswordBroker()->reset($credentials, function (User $user, string $password) { |
|
50 | + $response = $this->getPasswordBroker()->reset($credentials, function(User $user, string $password) { |
|
51 | 51 | $user->setAttribute('password', $this->hasher->make($password)); |
52 | 52 | |
53 | 53 | $user->setRememberToken(Str::random(60)); |
@@ -25,13 +25,13 @@ |
||
25 | 25 | |
26 | 26 | public function __invoke(IndexRequest $request): JsonResponse |
27 | 27 | { |
28 | - $builder = User::query()->select(['id', 'name', 'email']); |
|
28 | + $builder = User::query()->select([ 'id', 'name', 'email' ]); |
|
29 | 29 | |
30 | 30 | $this->filtering->builder($builder) |
31 | - ->filterFor('name', static function (Builder $builder, string $value) { |
|
31 | + ->filterFor('name', static function(Builder $builder, string $value) { |
|
32 | 32 | $builder->where('name', 'like', '%' . $value . '%'); |
33 | 33 | }) |
34 | - ->filterFor('email', static function (Builder $builder, string $value) { |
|
34 | + ->filterFor('email', static function(Builder $builder, string $value) { |
|
35 | 35 | $builder->where('email', 'like', '%' . $value . '%'); |
36 | 36 | }) |
37 | 37 | ->sortFor('name') |
@@ -38,7 +38,7 @@ |
||
38 | 38 | |
39 | 39 | try { |
40 | 40 | if ($this->dispensary->verify($user, $email, $request->input('token'))) { |
41 | - $user->update(['email' => $email]); |
|
41 | + $user->update([ 'email' => $email ]); |
|
42 | 42 | |
43 | 43 | return $this->responseFactory->noContent(Response::HTTP_OK); |
44 | 44 | } |
@@ -44,7 +44,7 @@ |
||
44 | 44 | /** @var User $user */ |
45 | 45 | $user = User::query()->where('email', $email)->first(); |
46 | 46 | |
47 | - if (! $user instanceof User) { |
|
47 | + if (!$user instanceof User) { |
|
48 | 48 | return $this->responseFactory->noContent(Response::HTTP_BAD_REQUEST); |
49 | 49 | } |
50 | 50 |
@@ -45,9 +45,9 @@ |
||
45 | 45 | |
46 | 46 | public function __invoke(AcceptRequest $request): JsonResponse |
47 | 47 | { |
48 | - $credentials = $request->only(['token', 'email', 'password', 'password_confirmation']); |
|
48 | + $credentials = $request->only([ 'token', 'email', 'password', 'password_confirmation' ]); |
|
49 | 49 | |
50 | - $response = $this->getPasswordBroker()->reset($credentials, function (User $user, string $password) { |
|
50 | + $response = $this->getPasswordBroker()->reset($credentials, function(User $user, string $password) { |
|
51 | 51 | $user->setAttribute('password', $this->hasher->make($password)); |
52 | 52 | |
53 | 53 | $user->setRememberToken(Str::random(60)); |
@@ -44,11 +44,11 @@ |
||
44 | 44 | { |
45 | 45 | $user = User::query()->where('email', $request->input('email'))->first(); |
46 | 46 | |
47 | - if (! $user instanceof User) { |
|
47 | + if (!$user instanceof User) { |
|
48 | 48 | $this->fail(); |
49 | 49 | } |
50 | 50 | |
51 | - if (! $this->hasher->check($request->input('password'), $user->getAuthPassword())) { |
|
51 | + if (!$this->hasher->check($request->input('password'), $user->getAuthPassword())) { |
|
52 | 52 | $this->fail(); |
53 | 53 | } |
54 | 54 |
@@ -48,20 +48,20 @@ discard block |
||
48 | 48 | 'redirect_uri' => $request->input('redirect_uri'), |
49 | 49 | ]); |
50 | 50 | |
51 | - if (! $request->filled(['email', 'token'])) { |
|
51 | + if (!$request->filled([ 'email', 'token' ])) { |
|
52 | 52 | return $this->responseFactory->redirectTo($url); |
53 | 53 | } |
54 | 54 | |
55 | 55 | $user = User::query()->where('email', $request->input('email'))->first(); |
56 | 56 | |
57 | - if (! $user instanceof User) { |
|
57 | + if (!$user instanceof User) { |
|
58 | 58 | return $this->responseFactory->redirectTo($url); |
59 | 59 | } |
60 | 60 | |
61 | 61 | try { |
62 | 62 | $verified = $this->dispensary->verify($user, $request->input('token')); |
63 | 63 | |
64 | - if (! $verified) { |
|
64 | + if (!$verified) { |
|
65 | 65 | return $this->responseFactory->redirectTo($url); |
66 | 66 | } |
67 | 67 | |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | $token = Str::random(128); |
70 | 70 | } while (UserToken::query()->where('token', $token)->exists()); |
71 | 71 | |
72 | - $user->tokens()->create(['token' => $token]); |
|
72 | + $user->tokens()->create([ 'token' => $token ]); |
|
73 | 73 | |
74 | 74 | return $this->responseFactory->redirectTo($url . '#token=' . $token); |
75 | 75 | } catch (TokenExpiredException $exception) { |
@@ -22,14 +22,14 @@ |
||
22 | 22 | 'current_password' => [ |
23 | 23 | 'required', |
24 | 24 | 'string', |
25 | - function ($attribute, $value, $fail) { |
|
25 | + function($attribute, $value, $fail) { |
|
26 | 26 | /** @var \App\Models\User $user */ |
27 | 27 | $user = $this->user(); |
28 | 28 | |
29 | 29 | /** @var Hasher $hasher */ |
30 | 30 | $hasher = $this->container->make(Hasher::class); |
31 | 31 | |
32 | - if (! $hasher->check($value, $user->getAuthPassword())) { |
|
32 | + if (!$hasher->check($value, $user->getAuthPassword())) { |
|
33 | 33 | $fail('Current password is invalid.'); |
34 | 34 | } |
35 | 35 | }, |
@@ -14,7 +14,7 @@ discard block |
||
14 | 14 | /** |
15 | 15 | * @inheritDoc |
16 | 16 | */ |
17 | - public function make(string $content = '', int $status = Response::HTTP_OK, array $headers = []): Response |
|
17 | + public function make(string $content = '', int $status = Response::HTTP_OK, array $headers = [ ]): Response |
|
18 | 18 | { |
19 | 19 | return new Response($content, $status, $headers); |
20 | 20 | } |
@@ -22,7 +22,7 @@ discard block |
||
22 | 22 | /** |
23 | 23 | * @inheritDoc |
24 | 24 | */ |
25 | - public function noContent(int $status = Response::HTTP_NO_CONTENT, array $headers = []): Response |
|
25 | + public function noContent(int $status = Response::HTTP_NO_CONTENT, array $headers = [ ]): Response |
|
26 | 26 | { |
27 | 27 | return $this->make('', $status, $headers); |
28 | 28 | } |
@@ -31,13 +31,13 @@ discard block |
||
31 | 31 | * @inheritDoc |
32 | 32 | */ |
33 | 33 | public function json( |
34 | - array $data = [], |
|
34 | + array $data = [ ], |
|
35 | 35 | int $status = Response::HTTP_OK, |
36 | - array $headers = [], |
|
36 | + array $headers = [ ], |
|
37 | 37 | int $options = 0 |
38 | 38 | ): JsonResponse { |
39 | - if (! array_key_exists('data', $data)) { |
|
40 | - $data = ['data' => $data]; |
|
39 | + if (!array_key_exists('data', $data)) { |
|
40 | + $data = [ 'data' => $data ]; |
|
41 | 41 | } |
42 | 42 | |
43 | 43 | return new JsonResponse($data, $status, $headers, $options); |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | public function paginator( |
50 | 50 | LengthAwarePaginator $paginator, |
51 | 51 | int $status = Response::HTTP_OK, |
52 | - array $headers = [], |
|
52 | + array $headers = [ ], |
|
53 | 53 | int $options = 0 |
54 | 54 | ): JsonResponse { |
55 | 55 | return $this->json([ |
@@ -72,7 +72,7 @@ discard block |
||
72 | 72 | LengthAwarePaginator $paginator, |
73 | 73 | callable $map, |
74 | 74 | int $status = Response::HTTP_OK, |
75 | - array $headers = [], |
|
75 | + array $headers = [ ], |
|
76 | 76 | int $options = 0 |
77 | 77 | ): JsonResponse { |
78 | 78 | $paginator->setCollection($paginator->getCollection()->map($map)); |