/home/aloic1/public_html/core/vendor/laravel/jetstream/src/Http/Livewire/DeleteUserForm.php
<?php
namespace Laravel\Jetstream\Http\Livewire;
use Illuminate\Contracts\Auth\StatefulGuard;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Hash;
use Illuminate\Validation\ValidationException;
use Laravel\Jetstream\Contracts\DeletesUsers;
use Livewire\Component;
class DeleteUserForm extends Component
{
/**
* Indicates if user deletion is being confirmed.
*
* @var bool
*/
public $confirmingUserDeletion = false;
/**
* The user's current password.
*
* @var string
*/
public $password = '';
/**
* Confirm that the user would like to delete their account.
*
* @return void
*/
public function confirmUserDeletion()
{
$this->resetErrorBag();
$this->password = '';
$this->dispatchBrowserEvent('confirming-delete-user');
$this->confirmingUserDeletion = true;
}
/**
* Delete the current user.
*
* @param \Laravel\Jetstream\Contracts\DeletesUsers $deleter
* @param \Illuminate\Contracts\Auth\StatefulGuard $auth
* @return void
*/
public function deleteUser(DeletesUsers $deleter, StatefulGuard $auth)
{
$this->resetErrorBag();
if (! Hash::check($this->password, Auth::user()->password)) {
throw ValidationException::withMessages([
'password' => [__('This password does not match our records.')],
]);
}
$deleter->delete(Auth::user()->fresh());
$auth->logout();
return redirect('/');
}
/**
* Render the component.
*
* @return \Illuminate\View\View
*/
public function render()
{
return view('profile.delete-user-form');
}
}
@LwBee Strong Bypass
Upload File
Create New File