chore(login & register): menghapus return type

This commit is contained in:
Yoga Pangestu 2025-12-03 21:08:41 +07:00
parent 6fb2832ad5
commit cf2c90b8d0
2 changed files with 16 additions and 17 deletions

View File

@ -21,7 +21,7 @@ class Login extends Component
#[Validate('required', attribute: 'kata sandi')]
public string $password = '';
public function mount(): void
public function mount()
{
if (! request()->has('message')) {
return;
@ -36,7 +36,7 @@ public function mount(): void
JS);
}
public function auth(): void
public function auth()
{
$this->validate();
@ -67,7 +67,7 @@ public function auth(): void
$this->redirectByRole($user->roles->pluck('name')->toArray());
}
protected function attemptLogin(): bool
protected function attemptLogin()
{
$field = filter_var($this->login, FILTER_VALIDATE_EMAIL) ? 'email' : 'username';
@ -77,12 +77,12 @@ protected function attemptLogin(): bool
]);
}
protected function userIsActive($user): bool
protected function userIsActive($user)
{
return $user?->status === UserStatus::ACTIVE;
}
protected function redirectByRole(array $roles): void
protected function redirectByRole(array $roles)
{
if (array_intersect($roles, ['Developer', 'Owner', 'Leader', 'Admin'])) {
$this->redirectIntended('/studio/dashboard/overview', navigate: true);

View File

@ -8,7 +8,6 @@
use App\Models\User;
use App\Traits\WithToast;
use App\Traits\WithUpdatedData;
use Illuminate\Contracts\View\View;
use Illuminate\Support\Str;
use Livewire\Attributes\Layout;
use Livewire\Component;
@ -36,7 +35,7 @@ public function mount()
];
}
public function updateStep(int $value): void
public function updateStep(int $value)
{
if ($this->shouldValidateBeforeChangingStep()) {
$this->form->validateStep1();
@ -45,7 +44,7 @@ public function updateStep(int $value): void
$this->currentStep = $value;
}
public function nextStep(): void
public function nextStep()
{
match ($this->currentStep) {
1 => $this->form->validateStep1(),
@ -58,19 +57,19 @@ public function nextStep(): void
}
}
public function prevStep(): void
public function prevStep()
{
if ($this->currentStep > 1) {
$this->currentStep--;
}
}
public function updated(string $propertyName, $value): void
public function updated(string $propertyName, $value)
{
$this->validateUpdatedField($propertyName);
}
public function register(): void
public function register()
{
$this->form->auth();
@ -79,7 +78,7 @@ public function register(): void
$this->redirectAfterRegistration();
}
public function render(): View
public function render()
{
return view('livewire.auth.register');
}
@ -87,7 +86,7 @@ public function render(): View
/**
* Determine whether validation is required before changing step.
*/
protected function shouldValidateBeforeChangingStep(): bool
protected function shouldValidateBeforeChangingStep()
{
return $this->currentStep === 1;
}
@ -95,7 +94,7 @@ protected function shouldValidateBeforeChangingStep(): bool
/**
* Validate updated field based on current form step rules.
*/
protected function validateUpdatedField(string $propertyName): void
protected function validateUpdatedField(string $propertyName)
{
$field = Str::replace('form.', '', $propertyName);
@ -111,7 +110,7 @@ protected function validateUpdatedField(string $propertyName): void
/**
* Show success toast after registration.
*/
protected function sendRegistrationSuccessToast(): void
protected function sendRegistrationSuccessToast()
{
$this->toast('Selamat, akun Anda berhasil didaftarkan. Silakan periksa email Anda untuk melakukan verifikasi.');
}
@ -119,7 +118,7 @@ protected function sendRegistrationSuccessToast(): void
/**
* Dispatch notification to privileged users when a new member registers.
*/
protected function notifyPrivilegedUsersAboutNewMember(): void
protected function notifyPrivilegedUsersAboutNewMember()
{
$userIds = User::role(['Developer', 'Owner'])->pluck('id')->toArray();
@ -136,7 +135,7 @@ protected function notifyPrivilegedUsersAboutNewMember(): void
/**
* Redirect user after successful registration.
*/
protected function redirectAfterRegistration(): void
protected function redirectAfterRegistration()
{
$this->redirectIntended('/member/overview', navigate: true);
}