1 year ago

Laravel API validation

Posted 1 year ago by evripidesk

Hello! I get an array from my frontend (Ionic) and I want to validate if there is an empty value, like the example below, the 0 has value the 1 doesnt has

(2) [{…}, {…}]
0: {value: "test"}
1: {value: ""}
length: 2
__proto__: Array(0)

I try the below but is not working for the 1 that has empty value, the validation is working if the array is totally empty

      $validator = Validator::make($input, [

        'exc' => 'array|required',
        'exc.*' => 'required',

Please sign in or create an account to participate in this conversation.