herbarium/app/Livewire/Settings/DeleteUserForm.php
Alyx Batte 5280d46d07
Some checks failed
linter / quality (push) Has been cancelled
tests / ci (push) Has been cancelled
initial commit
2025-11-18 19:31:28 -05: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);
}
}