You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

47 lines
1.0 KiB

<?php
declare(strict_types=1);
namespace App\Request;
use Hyperf\Validation\Request\FormRequest;
class AttachmentRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*/
public function authorize(): bool
{
return true;
}
/**
* Get the validation rules that apply to the request.
*/
public function rules(): array
{
return [
'upload' => 'required|nonempty|file|ext_not_in',
'type' => 'nonempty|alpha'
];
}
public function messages(): array
{
return [
'upload.required' => '未选择上传的文件',
'upload.nonempty' => '文件异常',
'upload.file' => '文件上传不成功',
'upload.ext_not_in' => '文件不允许上传',
'type.nonempty' => '文件类型参数异常',
];
}
public function attributes(): array
{
return [
'upload' => '文件'
];
}
}