how to pass custom validation message to cviebrock/image-validator in laravel?

喜你入骨 提交于 2020-01-15 05:01:00

问题


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:


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

$messages = array(
    'image_size'    => 'My custome message.',
);


来源:https://stackoverflow.com/questions/27520121/how-to-pass-custom-validation-message-to-cviebrock-image-validator-in-laravel

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!