parfum/app/Livewire/Auth/ForgotPassword.php

39 lines
865 B
PHP

<?php
namespace App\Livewire\Auth;
use App\Livewire\Forms\Auth\ForgotPasswordForm;
use App\Traits\WithToast;
use Illuminate\Support\Facades\Password;
use Illuminate\View\View;
use Livewire\Attributes\Layout;
use Livewire\Component;
#[Layout('components.layouts.auth', [
'title' => 'Lupa Kata Sandi',
])]
class ForgotPassword extends Component
{
use WithToast;
public ForgotPasswordForm $form;
public function sendLink(): mixed
{
$this->form->validate();
$status = Password::sendResetLink(
['form.email' => $this->form->email]
);
return $status === Password::ResetLinkSent
? $this->toast(__($status), 'Berhasil')
: $this->toast(__($status), 'Gagal', 'danger');
}
public function render(): View
{
return view('livewire.auth.forgot-password');
}
}