我有这个输入,但它不起作用,因为我有名字[]。任何建议如何解决这个问题?如果我删除此[{{$language->code}}]
则需要工作。
@foreach ($languages as $language)
<input type="text" id="text-title" name="article_title[{{$language->code}}]" value="" class="form_input" required="required">
@endforeach
<button type="submit" class="submit_property bg_green pull-right">CREATE ARTICLE</button>
验证规则:
public function rules()
{
return [
'article_title' => 'required:articles',
'slug' => 'required|unique:articles',
}
问题是我只在$language->id = 1
答案 0 :(得分:1)
您可以使用Laravel对数组的本机验证:
hasPart
答案 1 :(得分:0)
规则将是
public function rules()
{
return [
'article_title.*' => 'required',
'slug' => 'required|unique:articles',
];
}