|string> */ public function rules(): array { return [ 'product_id' => [ Rule::requiredIf($this->isMethod('post')), Rule::exists('products', 'id'), ], 'qty' => ['required', 'integer'], 'price' => [ Rule::requiredIf($this->isMethod('post')), 'integer', 'min:0', ], 'price_type' => [ Rule::requiredIf($this->isMethod('post')), Rule::enum(PriceType::class), ], ]; } }