feat(trait): membuat reusable close modal
This commit is contained in:
parent
35acc98e4f
commit
df41581385
23
app/Traits/WithCloseModal.php
Normal file
23
app/Traits/WithCloseModal.php
Normal file
@ -0,0 +1,23 @@
|
||||
<?php
|
||||
|
||||
namespace App\Traits;
|
||||
|
||||
use Flux\Flux;
|
||||
|
||||
trait WithCloseModal
|
||||
{
|
||||
public function closeModal(string $modalName, ?bool $isCloseAll = false)
|
||||
{
|
||||
$this->resetErrorBag();
|
||||
$this->resetValidation();
|
||||
$this->reset();
|
||||
|
||||
if ($isCloseAll) {
|
||||
Flux::modals()->close();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
Flux::modals($modalName)->close();
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user