feat(validity-time): add ValidityTimeResource and integrate into catalog and ticket resources
This commit is contained in:
@@ -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))
|
||||
|
||||
Reference in New Issue
Block a user