Aug 13, 2022
0
Level 1
laravel excel import validate each row on conditional basic
I want to validate each row separately .
example in
SR.NO check_required type 1 yes 2 no office
1 row there is coloum check_required has yes then i need to check in 1 row . I need to validate there type must has some value
2 row there is coloum check_required has no then i need to check in 2 row . I dont need to validate the type has value or not
i try with this but it not work
'*.type' => ['exclude_unless:check_required,no|required'],
i try with this but it not work
public function withValidator($validator) { $validator->sometimes('*.type', 'required', function($input) { dd($input); return strtolower($input->check_required) != "no"; });}
but it error for both records . i need it give error for only for first row
i try to die input . i see it give the array of all rows.
Please or to participate in this conversation.