From 6ca059e0c2c7f2db4c99e6ecff1b7365770fe44d Mon Sep 17 00:00:00 2001 From: frankyso Date: Tue, 4 Oct 2022 10:38:26 +0000 Subject: [PATCH] Fix styling --- config/satset.php | 5 +++-- .../Concerns/CanRegisterPushNotificationToken.php | 6 +++--- src/Http/Controllers/LoginController.php | 8 ++++---- tests/Features/Login/LoginTest.php | 4 ++-- 4 files changed, 12 insertions(+), 11 deletions(-) diff --git a/config/satset.php b/config/satset.php index 0efcfdb..3f130c5 100644 --- a/config/satset.php +++ b/config/satset.php @@ -1,4 +1,5 @@ [ - 'model' => "App\\Models\\User" + 'model' => 'App\\Models\\User', ], 'push_notification' => [ - ] + ], ]; diff --git a/src/Http/Controllers/Concerns/CanRegisterPushNotificationToken.php b/src/Http/Controllers/Concerns/CanRegisterPushNotificationToken.php index b5fee37..6eee709 100644 --- a/src/Http/Controllers/Concerns/CanRegisterPushNotificationToken.php +++ b/src/Http/Controllers/Concerns/CanRegisterPushNotificationToken.php @@ -20,15 +20,15 @@ public function getNotificationTokenParameterName() */ public function registerPushNotification() { - if (!$this->shouldRegisterPushNotificationToken) { + if (! $this->shouldRegisterPushNotificationToken) { return; } - if (!method_exists($this->user(), 'pushNotificationToken')) { + if (! method_exists($this->user(), 'pushNotificationToken')) { return; } - if (!request()->filled($this->getNotificationTokenParameterName())) { + if (! request()->filled($this->getNotificationTokenParameterName())) { return; } diff --git a/src/Http/Controllers/LoginController.php b/src/Http/Controllers/LoginController.php index 1f76179..354d920 100644 --- a/src/Http/Controllers/LoginController.php +++ b/src/Http/Controllers/LoginController.php @@ -51,13 +51,13 @@ public function columnIdentifier(): array public function columnIdentifierMap() { - return collect($this->columnIdentifier())->mapWithKeys(fn($item, $key) => [$key => \request()->get($item)]); + return collect($this->columnIdentifier())->mapWithKeys(fn ($item, $key) => [$key => \request()->get($item)]); } /** * Handle the incoming request. * - * @param Request $request + * @param Request $request * @return Response * * @throws ContainerExceptionInterface @@ -106,7 +106,7 @@ protected function user(): Response|Model }); } - if (!Hash::check(\request()->get('password'), @$user->password)) { + if (! Hash::check(\request()->get('password'), @$user->password)) { return SSResponse::validationFailed(function (SSResponseMessageBag $errorBag) { $errorBag->add(field: 'email', message: 'Email atau password tidak valid silahkan coba lagi'); @@ -114,7 +114,7 @@ protected function user(): Response|Model }); } - if (!method_exists($user, 'createToken')) { + if (! method_exists($user, 'createToken')) { throw new Exception("Your User model not use \"Laravel\Sanctum\HasApiTokens\" Traits"); } diff --git a/tests/Features/Login/LoginTest.php b/tests/Features/Login/LoginTest.php index 88e5ff4..16a00ee 100644 --- a/tests/Features/Login/LoginTest.php +++ b/tests/Features/Login/LoginTest.php @@ -10,7 +10,7 @@ use function Pest\Laravel\assertDatabaseHas; use function Pest\Laravel\postJson; -function createUser($email = "frankyso.mail@gmail.com", $password = "password", ...$data): User +function createUser($email = 'frankyso.mail@gmail.com', $password = 'password', ...$data): User { return User::create( array_merge([ @@ -114,7 +114,7 @@ function registerRoute(?string $controller = null): void [ 'email' => 'frankyso.mail@gmail.com', 'password' => 'password', - 'notification_token' => '123456' + 'notification_token' => '123456', ]) ->assertOk();