Files
core/src/Order/DTOs/OrderFulfillmentResult.php
T

31 lines
891 B
PHP

<?php
namespace Modules\Core\Order\DTOs;
/**
* What a Modules\Core\Order\Services\OrderFulfillmentService method
* returns instead of throwing/echoing a Filament notification directly —
* keeps that service usable outside a Filament action (a future API
* endpoint, a console command, a test) without dragging
* Filament\Notifications\Notification along. Modules\Core\Shipping\
* Extensions\OrderViewExtension is the one place that translates this
* into an actual on-screen notification.
*/
final class OrderFulfillmentResult
{
private function __construct(
public readonly bool $success,
public readonly string $message,
) {}
public static function success(string $message): self
{
return new self(true, $message);
}
public static function failure(string $message): self
{
return new self(false, $message);
}
}