Files
laraundfelix/app/Filament/Support/ReportsDomainRules.php
LarsandCursor fef0ea2ac2
Deploy Test / test (push) Successful in 12s
Deploy Test / deploy (push) Successful in 32s
Halte Auswirkung und Rückzug beim Veröffentlichen eines Artikel-Stands fest.
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-11-15 09:07:14 +01:00

20 lines
554 B
PHP

<?php
namespace App\Filament\Support;
use App\Domain\Catalog\DomainRuleException;
use Filament\Notifications\Notification;
trait ReportsDomainRules
{
protected function report(callable $callback, string $success): void
{
try {
$detail = $callback();
Notification::make()->title(is_string($detail) && $detail !== '' ? $detail : $success)->success()->send();
} catch (DomainRuleException $exception) {
Notification::make()->title($exception->getMessage())->danger()->send();
}
}
}