【发布时间】:2019-11-11 23:41:11
【问题描述】:
首先我可以说,搜索后我没有找到任何解决方案。我做这个帖子的验证数组:laravel validation array
我需要验证每个大小数组的位置。我写了这个验证码:
// Fields validation
$request->validate([
'name' => 'required|max:150',
'theySay' => 'nullable|array',
'theySay.*' => 'string|max:1000',
'theyDontSay' => 'nullable|array',
'theyDontSay.*' => 'string|max:1000',
]
其中 theySay 和 theyDontSay 都是字符串数组。在迁移中,我有两个字段(文本),比如 1000 个字符的字符串。
$table->string('text', 1000);
验证工作正常。我的意思是,如果输入的文本超过 1000 个字符,我将无法保存,但..不要显示任何错误消息。
我希望错误消息像其他字段一样显示在输入中。
我做错了什么?
最好的问候
【问题讨论】:
标签: php arrays string laravel validation