scripthost/app/Livewire/Settings/DeleteUserForm.php
Javier Feliz 9b2b993418
Some checks are pending
linter / quality (push) Waiting to run
tests / ci (push) Waiting to run
Setup
2025-07-22 17:49:01 -04:00

27 lines
550 B
PHP

<?php
namespace App\Livewire\Settings;
use App\Livewire\Actions\Logout;
use Illuminate\Support\Facades\Auth;
use Livewire\Component;
class DeleteUserForm extends Component
{
public string $password = '';
/**
* Delete the currently authenticated user.
*/
public function deleteUser(Logout $logout): void
{
$this->validate([
'password' => ['required', 'string', 'current_password'],
]);
tap(Auth::user(), $logout(...))->delete();
$this->redirect('/', navigate: true);
}
}