我正在验证Laravel(5.2)
中的嵌套属性$this->validate($request, [
'title' => 'required',
'author.name' => 'required',
'author.description' => 'required',
]);
在我的自定义验证语言文件标题中有效,但author.name
和author.description
不起作用。
'custom' => [
'title' => [
'required' => 'The title is required',
],
'author.name' => [
'required' => 'Name is required',
],
'author.description' => [
'required' => 'Description is required',
],
],
答案 0 :(得分:1)
所有属性都应该在子数组中。
'custom' => [
'title' => [
'required' => 'The title is required',
],
'author' => [
'name' => [
'required' => 'Name is required',
],
'description' => [
'required' => 'Description is required',
],
],
],