[Vuejs]-Validate and saving an array of objects laravel 6, vue, axios

0👍

Basically you want to customize your errorbag right ? try this one out. Add this inside your fail condition. Let me know if it works.

$err = [{imei:xxxx,errorMsg: 'already exist in DB'}]; 

foreach ($validator->errors()->toArray() as $error)  {
    foreach($error as $sub_error) {
           array_push($err, $sub_error);
        }
  }
return ['errors'=>$err];

Leave a comment