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.
 
 

46 lines
974 B

<?php
declare(strict_types=1);
namespace App\Request;
use Hyperf\Validation\Request\FormRequest;
class ImageBase64Request 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|base64:image',
'type' => 'nonempty|alpha'
];
}
public function messages(): array
{
return [
'upload.required' => '未选择上传的文件',
'upload.base64' => '文件不是正常的图片',
'upload.nonempty' => '文件异常',
'type.nonempty' => '图片类型参数异常',
];
}
public function attributes(): array
{
return [
'upload' => '图片'
];
}
}