Home > Back-end >  Laravel validation in combination of two array data
Laravel validation in combination of two array data

Time:06-27

How could I validate it from request file? I want to check distinct combining floor_id and material_id, having a floor id can not have same material_id twice or more

From a form data i get this kind of output

project_id => 5,
date => 12-15-2022,
floor_id => array(
0=> 1,
1=> 5,
2=> 12
),
material_id => array(
0=>15,
1=>2,
2=>20
),
quantity => array(
0=>2500,
1=>3500,
2=>6522
)

How could I validate it from request file

CodePudding user response:

may be you can use validation distinct

https://laravel.com/docs/9.x/validation#rule-distinct

CodePudding user response:

You can write a custom validation rule to serve your purpose.

Here you will get some idea https://laravel.com/docs/9.x/validation#custom-validation-rules

  • Related