UserQuotationRequest.php 1.58 KB
<?php

namespace App\Http\Container\AppSection\Requests;

use Hikoon\LaravelApi\Support\ApiRequest;

class UserQuotationRequest extends ApiRequest
{
    /**
     * @return string[]
     */
    public function rules(): array
    {
        return [
            'is_reward'      => 'required|in:0,1',
            'reward_price'   => 'required_if:is_reward,1|numeric|between:0,99999999',
            'is_dividend'    => 'required|in:0,1',
            'dividend_year'  => 'required_if:is_dividend,1|string',
            'dividend_ratio' => 'required_if:is_dividend,1|numeric|between:0,100',
            'is_talk'        => 'required|in:0,1',
            'is_public'      => 'required|in:0,1',
        ];
    }

    /**
     * @return array
     */
    public function messages(): array
    {
        return [
            'is_reward.*'                => '请选择是否同意唱酬',
            'is_dividend.*'              => '请选择是否同意分成',
            'is_talk.*'                  => '请选择是否可谈',
            'is_public.*'                => '请选择是否公开',
            'reward_price.required_if'   => '请输入唱酬金额',
            'reward_price.numeric'       => '唱酬金额类型错误',
            'reward_price.between'       => '唱酬金额区间:min~:max',
            'dividend_year.required_if'  => '请选择分成年限',
            'dividend_ratio.required_if' => '请输入分成比例',
            'dividend_ratio.numeric'     => '分成比例类型错误',
            'dividend_ratio.between'     => '分成比例区间:min~:max'


        ];
    }
}