feat: add GeneratesUniqueSlug class for unique slug generation
feat: create PostCategoryFactory for generating post category data feat: create PostFactory for generating post data feat: add retry_requested_at column to services table feat: add vcenter provisioning fields to products table feat: add module_host_id to os table feat: create email_notification_templates table for email templates feat: add scenario and format fields to template table feat: add admin fields to transactions table fix: update ticket table columns and types feat: add uuid to ticket table and backfill existing records fix: make ticket_reply user_id nullable feat: create notifications table for user notifications fix: make ticket uuid nullable feat: create post_categories table for blog categories feat: create posts table for blog posts feat: add invoice email template for PDF generation
This commit is contained in:
@@ -32,9 +32,24 @@ class ProductResource extends JsonResource
|
||||
'bandwidth' => $this->bandwidth,
|
||||
'setup_fee' => $this->setup_fee,
|
||||
'min_price' => $minPrice,
|
||||
'billing_type' => $this->whenLoaded('pricings', function () {
|
||||
$hasOnetime = $this->pricings->where('billing_cycle', 'onetime')->isNotEmpty();
|
||||
$hasRecurring = $this->pricings->where('billing_cycle', '!=', 'onetime')->isNotEmpty();
|
||||
return ($hasOnetime && !$hasRecurring) ? 'onetime' : 'recurring';
|
||||
}),
|
||||
'currency' => $this->whenLoaded('pricings', fn () => $this->pricings->first()?->currency ?? 'VND'),
|
||||
'price_monthly' => $this->whenLoaded('pricings', fn () => optional($this->pricings->firstWhere('billing_cycle', 'monthly'))->price),
|
||||
'price_quarterly' => $this->whenLoaded('pricings', fn () => optional($this->pricings->firstWhere('billing_cycle', 'quarterly'))->price),
|
||||
'price_semiannually' => $this->whenLoaded('pricings', fn () => optional($this->pricings->firstWhere('billing_cycle', 'semiannually'))->price),
|
||||
'price_annually' => $this->whenLoaded('pricings', fn () => optional($this->pricings->firstWhere('billing_cycle', 'annually'))->price),
|
||||
'price_biennially' => $this->whenLoaded('pricings', fn () => optional($this->pricings->firstWhere('billing_cycle', 'biennially'))->price),
|
||||
'price_triennially' => $this->whenLoaded('pricings', fn () => optional($this->pricings->firstWhere('billing_cycle', 'triennially'))->price),
|
||||
'price_onetime' => $this->whenLoaded('pricings', fn () => optional($this->pricings->firstWhere('billing_cycle', 'onetime'))->price),
|
||||
'is_active' => $this->is_active,
|
||||
'created_at' => $this->created_at,
|
||||
'os_ids' => $osIds,
|
||||
'module_host_id' => $this->module_host_id,
|
||||
'module_datastore_id' => $this->module_datastore_id,
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user