1
我遇到問題required_without_all
。我有三個元素,至少一個應該填充。我的文件輸入名稱是image[]
。添加一張圖片但是仍然保留title
和body
仍然會導致驗證錯誤,即使它不應該。Laravel 5.2 required_without_all請求問題
有關我在做什麼錯的任何想法?
public function rules()
{
return [
'title' => 'required_without_all:body,image.*',
'body' => 'required_without_all:title,image.*',
'image.*' => 'required_without_all:body,title',
];
}
public function messages()
{
return [
'title.required_without_all' => 'At least one field is required',
'body.required_without_all' => 'At least one field is required',
'image.*.required_without_all' => 'At least one field is required',
];
}