samedi 22 février 2020

Make Laravel request from array with objects

I have an array that makes in front end with js and pass that to my controller with ajax.

structure of array is this:

[{FirstName: "fff"},
{LastName: null},
{Nationality: null},
{Year: null},
{Month: null},
{Day: null}]

I can't validate this array with request validation laravel. Now I'm going to turn this array into a Larval request to apply the rules to it.

Rules:

 $validator = Validator::make($maked_laravel_request_from_array, [
                    'FirstName' => 'required',
                    'lastName' => 'required',
                ]);

Can any one helps?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire