Feat: confirm server deletion

This commit is contained in:
ayntk-ai
2024-09-04 20:06:22 +02:00
parent 9515bc6162
commit 371fe53911
2 changed files with 29 additions and 7 deletions

View File

@@ -4,6 +4,8 @@ namespace App\Livewire\Server;
use Illuminate\Foundation\Auth\Access\AuthorizesRequests;
use Livewire\Component;
use Illuminate\Support\Facades\Hash;
use Illuminate\Support\Facades\Auth;
class Delete extends Component
{
@@ -11,8 +13,12 @@ class Delete extends Component
public $server;
public function delete()
public function delete($password)
{
if (!Hash::check($password, Auth::user()->password)) {
$this->addError('password', 'The provided password is incorrect.');
return;
}
try {
$this->authorize('delete', $this->server);
if ($this->server->hasDefinedResources()) {