首先我可以说在搜索之后我没有找到任何关于这个的解决方案。我像这篇文章一样做验证数组: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 个字符的文本,我将无法保存,但……不显示任何错误消息。
我希望错误消息像其他字段一样显示在输入中。
我究竟做错了什么?
HUWWW
MYYA