I'm having a weird problem, using Laravel 5.3
Here's a small snippet of my validation
$validator = Validator::make($request->all(), [
'item_rows.*.imei' => 'unique:t_inventory_imei,imei_barcode,NULL,id,status,'."A",
'item_rows.*.quantity' => 'required|numeric|not_in:0',
'item_rows.*.cost_price' => 'required|numeric|not_in:0',
'item_rows.*.id_inventory' => 'required|numeric|not_in:0',
'item_rows.*.id_branch' => 'required|numeric|not_in:0',
'item_rows.*.id_branch_location' => 'required|numeric|not_in:0',
'ref_document_no' => 'required',
'ref_doc_date' => 'required|date',
]);
Problem comes when unique:t_inventory_imei,imei_barcode,NULL,id,status,
."A" this rule is available.
This rule doesn't seem to be validated, it will effect the last rule to be validation error, say returning {"message":"validation_fail","validation_error":{"currentRule":"date"}}
If I remove the last row, it will cascade up and so on {"message":"validation_fail","validation_error":{"currentRule":"required"}}
If I remove every rule leaving only the first unique rule, the validation works, it is able to detect unique row with rule status A.
Is this a bug from Laravel or is there something wrong with the code?