fixes here and there

This commit is contained in:
ayntk-ai
2024-09-02 19:27:21 +02:00
parent 843e3fb599
commit dfd218ec06
11 changed files with 58 additions and 79 deletions

View File

@@ -1,8 +1,6 @@
<?php
namespace App\Livewire\Destination;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Hash;
use Livewire\Component;
class Form extends Component
@@ -27,13 +25,8 @@ class Form extends Component
$this->destination->save();
}
public function delete($password)
public function delete()
{
if (!Hash::check($password, Auth::user()->password)) {
$this->addError('password', 'The provided password is incorrect.');
return;
}
try {
if ($this->destination->getMorphClass() === 'App\Models\StandaloneDocker') {
if ($this->destination->attachedTo()) {
@@ -44,7 +37,7 @@ class Form extends Component
}
$this->destination->delete();
return redirect()->route('dashboard');
return redirect()->route('destination.all');
} catch (\Throwable $e) {
return handleError($e, $this);
}