Answers for "laravel required item in array"

PHP
0

how to use required_with in laravel to array element

$validator = Validator::make($request->all(), [
    "currency"    => "nullable|required_with:price.*|string",
    //or if you want to check currency for first price then use
    // "currency"    => "nullable|required_with:price.0|string",
    "price"    => "required|array|min:3",
    "price.*"  => "required|string|distinct|min:3",
]);
Posted by: Guest on January-09-2021

Browse Popular Code Answers by Language