ProjectDynamicQueryRequest.php 941 Bytes
<?php


namespace App\Http\Container\AppSection\Requests;


use Hikoon\LaravelApi\Support\ApiRequest;

class ProjectDynamicQueryRequest extends ApiRequest
{

    protected function prepareForValidation(): void
    {
        $this->mergeIfMissing([
            'pageSize' => 20
        ]);
    }

    /**
     * @return string[]
     */
    public function rules(): array
    {
        return [
            'project_id'  => 'required|integer',
            'type'     => 'required|in:image,video,audio',
            'pageSize' => 'required|integer|max:100'
        ];
    }

    /**
     * @return string[]
     */
    public function messages(): array
    {
        return [
            'project_id.required' => '请选择查看厂牌',
            'type.required'    => '请选择查看方式',
            'type.in'          => '查看方式不存在',
            'pageSize'         => '每页显示数不能超过:max'
        ];
    }
}