Sep 29, 2024
0
Level 2
First value is repeated for each query of nested array validation !
The rule is
'val.*.bond_row_id' => [
'required',
Rule::exists('general-data.rased_eftetahies', 'id')->where(function (Builder $query) {
return $query->where('branch_code_id', $this->def_branch)
->where('product_code', $this->input('val.*.product_code'))
->where('insertion_num', $this->input('val.*.insertion_num'));
}),
],
The query is
select count(*) as aggregate from `rased_eftetahies` where `id` = '40381' and (`branch_code_id` = '1' and `product_code` = '263' and `insertion_num` = '92')
select count(*) as aggregate from `rased_eftetahies` where `id` = '40382' and (`branch_code_id` = '1' and `product_code` = '263' and `insertion_num` = '92')
But insertion_num should be in the second query 93 instead of 92
select count(*) as aggregate from `rased_eftetahies` where `id` = '40381' and (`branch_code_id` = '1' and `product_code` = '263' and `insertion_num` = '92')
select count(*) as aggregate from `rased_eftetahies` where `id` = '40381' and (`branch_code_id` = '1' and `product_code` = '263' and `insertion_num` = '93')
and the request is
"val" => array:2 [
0 => array:17 [
"selected_row" => "1"
"visible_product_code" => "2165"
"product_code" => "263"
"bond_row_id" => "40381"
"insertion_num" => "92"
"quantity" => "4.9"
"stone_weight" => "0"
"cost_price" => "0.000"
"selling_price" => "0.000"
"salary" => "35.000"
"total_salaries" => "171.500"
"discount_value" => "0.000"
"total_cost_price" => "0.000"
"total_selling_price" => "0.000"
"bond_num" => "0010003494"
"bond_date" => "2024/05/21"
"def_branch" => "1"
]
1 => array:17 [
"selected_row" => "1"
"visible_product_code" => "2165"
"product_code" => "263"
"bond_row_id" => "40382"
"insertion_num" => "93"
"quantity" => "6.2"
"stone_weight" => "0"
"cost_price" => "0.000"
"selling_price" => "0.000"
"salary" => "35.000"
"total_salaries" => "217.000"
"discount_value" => "0.000"
"total_cost_price" => "0.000"
"total_selling_price" => "0.000"
"bond_num" => "0010003494"
"bond_date" => "2024/05/21"
"def_branch" => "1"
]
]
Please or to participate in this conversation.