我的传入JSON对象:
{
"date": "2018-10-10",
"fiche": 1,
"fiche_type": 2,
"description": "test",
"project_code": "444",
"invoces":
[
{
"id": 1,
"description": "Ol",
"amount": 300,
"type": "debit"
},
{
"id": 2,
"type" :"credit",
"description": "Ol2",
"amount": 200
}
]
}
验证规则是:
public function rules()
{
return [
'date' => 'required|date_format:Y-m-d',
'fiche' => 'required|integer',
'fiche_type' => 'required|integer',
'description' => 'string',
'project_code' => 'string',
'invoices' => 'required|array',
'invoices.id' => 'required|integer',
'invoices.description' => 'string',
'invoices.amount' => 'required|numeric',
'invoices.type' => 'required|string',
];
}
我总是会遇到以下常见错误:错误的数据验证