From 08df81440878cebf1e44013490bafc14a7bb88d7 Mon Sep 17 00:00:00 2001
From: ayntk-ai <122374094+ayntk-ai@users.noreply.github.com>
Date: Wed, 4 Sep 2024 22:33:47 +0200
Subject: [PATCH] Feat: delete volume confirmation
---
app/Livewire/Project/Shared/Storages/Show.php | 10 +++++++++-
.../project/shared/storages/show.blade.php | 18 +++++++++++-------
2 files changed, 20 insertions(+), 8 deletions(-)
diff --git a/app/Livewire/Project/Shared/Storages/Show.php b/app/Livewire/Project/Shared/Storages/Show.php
index 08f51ce08..d350df212 100644
--- a/app/Livewire/Project/Shared/Storages/Show.php
+++ b/app/Livewire/Project/Shared/Storages/Show.php
@@ -3,6 +3,8 @@
namespace App\Livewire\Project\Shared\Storages;
use App\Models\LocalPersistentVolume;
+use Illuminate\Support\Facades\Hash;
+use Illuminate\Support\Facades\Auth;
use Livewire\Component;
class Show extends Component
@@ -36,8 +38,14 @@ class Show extends Component
$this->dispatch('success', 'Storage updated successfully');
}
- public function delete()
+ public function delete($password)
{
+ if (!Hash::check($password, Auth::user()->password)) {
+ $this->addError('password', 'The provided password is incorrect.');
+ return;
+ }
+
+ // Test deletion in more detail
$this->storage->delete();
$this->dispatch('refreshStorages');
}
diff --git a/resources/views/livewire/project/shared/storages/show.blade.php b/resources/views/livewire/project/shared/storages/show.blade.php
index d6ee66ab7..2e43861ab 100644
--- a/resources/views/livewire/project/shared/storages/show.blade.php
+++ b/resources/views/livewire/project/shared/storages/show.blade.php
@@ -46,13 +46,17 @@
Update
-
- This storage will be deleted {{ $storage->name }}.
- It
- is
- not
- reversible.
Please think again.
-
+
@endif