Skip to content

Open-source event management and ticket selling platform — perfect for concerts, conferences, and everything in between 🎟️ If you find this project helpful, please consider giving us a star ⭐️

1.3 KB
Raw Blame
<?php

declare(strict_types=1);

namespace HiEvents\Http\Request\Order;

use HiEvents\Http\Request\BaseRequest;
use HiEvents\Services\Domain\Order\OrderCreateRequestValidationService;

class CreateOrderRequest extends BaseRequest
{
    /**
     * @see OrderCreateRequestValidationService
     */
    public function rules(): array
    {
        if ($this->route() !== null) {
            return [];
        }

        return [
            'products' => ['required', 'array'],
            'products.*.product_id' => ['required', 'integer'],
            'products.*.event_occurrence_id' => ['integer', 'nullable'],
            'products.*.quantities' => ['required', 'array'],
            'products.*.quantities.*.quantity' => ['required', 'integer', 'min:0'],
            'products.*.quantities.*.price_id' => ['required', 'integer'],
            'products.*.quantities.*.price' => ['numeric', 'min:0', 'nullable'],
            'products.*.quantities.*.seat_uids' => ['array', 'nullable', 'max:100'],
            'products.*.quantities.*.seat_uids.*' => ['string', 'max:24'],
            'products.*.quantities.*.band_key' => ['nullable', 'string', 'max:24'],
            'promo_code' => ['nullable', 'string'],
            'affiliate_code' => ['nullable', 'string'],
            'widget_id' => ['nullable', 'string', 'max:50'],
        ];
    }
}