-
-
Notifications
You must be signed in to change notification settings - Fork 69
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #113 from devaslanphp/dev
Resolve Sonar duplicated lines
- Loading branch information
Showing
8 changed files
with
96 additions
and
122 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
<?php | ||
|
||
namespace App\Core; | ||
|
||
use Exception; | ||
use Filament\Notifications\Actions\Action; | ||
use Filament\Notifications\Notification; | ||
|
||
trait CrudDialogHelper | ||
{ | ||
|
||
public bool $deleteConfirmationOpened = false; | ||
|
||
/** | ||
* Delete confirmation function | ||
* | ||
* @param string $title | ||
* @param string $body | ||
* @param string $deleteEvent | ||
* @param string $cancelEvent | ||
* @return void | ||
* @throws Exception | ||
*/ | ||
public function deleteConfirmation(string $title, string $body, string $deleteEvent, string $cancelEvent): void | ||
{ | ||
$this->deleteConfirmationOpened = true; | ||
Notification::make() | ||
->warning() | ||
->title($title) | ||
->body($body) | ||
->actions([ | ||
Action::make('confirm') | ||
->label(__('Confirm')) | ||
->color('danger') | ||
->button() | ||
->close() | ||
->emit($deleteEvent), | ||
Action::make('cancel') | ||
->label(__('Cancel')) | ||
->close() | ||
->emit($cancelEvent) | ||
]) | ||
->persistent() | ||
->send(); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters