<?php

namespace Modules\Mall\Http\Requests\OrderBuy;

use Illuminate\Foundation\Http\FormRequest;

class OrderBuyRequest extends FormRequest
{

    public function rules(): array
    {
        return [
            'goods_sku_id' => 'required|integer',
            'qty'          => 'nullable|integer',
            'address_id'   => ['nullable', 'required', 'integer'],
        ];
    }

    public function messages(): array
    {
        return [
            'goods_sku_id.required' => '缺少商品规格id',
            'goods_sku_id.integer'  => '商品规格id必须是数字',
            'qty.integer'           => '数量必须是数字',
            'address_id.required'   => '缺少收货地址',
            'address_id.integer'    => '收货地址必须是数字',
        ];
    }

}
