feat(validity-time): add ValidityTimeResource and integrate into catalog and ticket resources

This commit is contained in:
2026-08-06 16:13:29 -03:00
parent 7561ba756c
commit 20dd246cd8
9 changed files with 113 additions and 1 deletions

View File

@@ -3,6 +3,7 @@
namespace App\Domains\Catalog\Resources;
use App\Domains\Catalog\Models\CatalogItem;
use App\Domains\Ticket\Resources\ValidityTimeResource;
use Illuminate\Http\Request;
use Illuminate\Http\Resources\Json\JsonResource;
@@ -26,6 +27,10 @@ class CatalogItemResource extends JsonResource
'inventory_policy' => $this->inventory_policy?->value,
'has_tickets' => $this->has_tickets,
'validity_time_id' => $this->validity_time_id,
'validity_time' => $this->whenLoaded(
'validityTime',
fn () => ValidityTimeResource::make($this->validityTime),
),
'real_stock' => $this->whenLoaded('inventory', fn () => $this->inventory?->real_stock),
'images' => $this->whenLoaded('attachments', fn () => $this->attachments
->map(fn ($attachment) => $attachment->getTemporaryUrl(1440))