如何将自定义验证消息传递给laravel中的cviebrock/image-validator? [英] how to pass custom validation message to cviebrock/image-validator in laravel?

查看:51
本文介绍了如何将自定义验证消息传递给laravel中的cviebrock/image-validator?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 cviebrock 来验证laravel中的图像大小.多数民众赞成在正常工作.但是我想自定义错误消息.

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

我创建了一个消息数组

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

并传递给

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

但这没用.

-谢谢 阿伦

推荐答案

您使用了错误的名称,它应该带有下划线,例如

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

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

这篇关于如何将自定义验证消息传递给laravel中的cviebrock/image-validator?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆