Laravel voyager validation

时间:2018-02-03 09:46:49

标签: php laravel-5.3 voyager

I try to use validation in Laravel Voyager. When I set validation rule for image like

    {
    "validation": {
        "rule": 
  "required|image|mimes:jpeg,png,jpg,gif,svg|max:2048|dimensions:width=500,height=500"
    }
}

Though I have select an image it always shows an error The default img field is required.

But If I remove the required part from the validation rule like

    {
    "validation": {
        "rule": "image|mimes:jpeg,png,jpg,gif,svg|max:2048|dimensions:width=500,height=500"
    }
}

Then it doesn't show any error though I have select an image with below dimension.

Is there any error ?

1 个答案:

答案 0 :(得分:0)

基本上,您只需要小写显示名称(假设它们相同),例如name而不是Nameorder而不是Order