I have an array which i'm getting through request:
$rules=[];
$Fields=[];
foreach($request->input('users') as $user) {
$Fields+=$user['name'];
array_push($rules, [$user['name'] => 'required']);
}
Now i'm trying to validate it as follows:
$validate = Validator::make($Fields,$rules);
if($validate->fails()){
echo "Fails";
} else {
echo "Pass";
}
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire