delete project confirmation
This commit is contained in:
@@ -3,6 +3,8 @@
|
|||||||
namespace App\Livewire\Project;
|
namespace App\Livewire\Project;
|
||||||
|
|
||||||
use App\Models\Project;
|
use App\Models\Project;
|
||||||
|
use Illuminate\Support\Facades\Auth;
|
||||||
|
use Illuminate\Support\Facades\Hash;
|
||||||
use Livewire\Component;
|
use Livewire\Component;
|
||||||
|
|
||||||
class DeleteProject extends Component
|
class DeleteProject extends Component
|
||||||
@@ -21,8 +23,12 @@ class DeleteProject extends Component
|
|||||||
$this->projectName = Project::findOrFail($this->project_id)->name;
|
$this->projectName = Project::findOrFail($this->project_id)->name;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function delete()
|
public function delete($password)
|
||||||
{
|
{
|
||||||
|
if (!Hash::check($password, Auth::user()->password)) {
|
||||||
|
$this->addError('password', 'The provided password is incorrect.');
|
||||||
|
return;
|
||||||
|
}
|
||||||
$this->validate([
|
$this->validate([
|
||||||
'project_id' => 'required|int',
|
'project_id' => 'required|int',
|
||||||
]);
|
]);
|
||||||
|
@@ -2,12 +2,11 @@
|
|||||||
title="Confirm Project Deletion?"
|
title="Confirm Project Deletion?"
|
||||||
buttonTitle="Delete Project"
|
buttonTitle="Delete Project"
|
||||||
isErrorButton
|
isErrorButton
|
||||||
action="delete_project"
|
submitAction="delete"
|
||||||
:actions="['This will delete the selected project.']"
|
:actions="['This will delete the selected project.']"
|
||||||
confirmationLabel="Please confirm the execution of the actions by entering the Project Name below"
|
confirmationLabel="Please confirm the execution of the actions by entering the Project Name below"
|
||||||
shortConfirmationLabel="Project Name"
|
shortConfirmationLabel="Project Name"
|
||||||
submitAction="delete_project"
|
|
||||||
buttonTitle="Delete Project"
|
buttonTitle="Delete Project"
|
||||||
confirmText="{{ $projectName }}"
|
confirmationText="{{ $projectName }}"
|
||||||
step3ButtonText="Permanently Delete Project"
|
step3ButtonText="Permanently Delete Project"
|
||||||
/>
|
/>
|
||||||
|
Reference in New Issue
Block a user