如何使用自定义的请求验证,我有一个数组密钥请求如何使用自定义请求验证laravel数组?
$request = [
'link_inc_characteristic_id' => $inc_char_id[$i],
'value' => $value[$i],
'created_by' => $created_by,
'last_updated_by' => $last_updated_by,
];
$this->validate($request, [
'value['.$i.']' => 'max:30'
]);
$linkIncCharacteristicValue = LinkIncCharacteristicValue::create($request);
return Response::json($linkIncCharacteristicValue);
[编辑] [CODE增订] 显示错误:
Argument 1 passed to App\Http\Controllers\Controller::validate() must be an instance of Illuminate\Http\Request, array given,
您收到了哪些错误? –
验证不起作用,没有错误.....输入值自动裁减数据库字段长度,从验证没有错误.. – Khoerodin
我只是更新代码..并得到错误 – Khoerodin