how to pass custom validation message to cviebrock

2019-07-20 12:23发布

I am using cviebrock for validating image size in laravel. And thats working fine. But I want to customize the error message.

I created an array of message

 $messages = array(
        'image-size'    => 'My custome message.',
    );

and passed to

$validation = Validator::make(array($file => $fileObj), array($file  => $rules), $messages);

But thats not working.

-Thanks Arun

1条回答
Melony?
2楼-- · 2019-07-20 13:13

You're using the wrong name, it should be with an underline, like

$messages = array(
    'image_size'    => 'My custome message.',
);
查看更多
登录 后发表回答