samedi 3 août 2019

How to get POST data in Laravel?

I send POST data like this:

{
  "email": "oli@mail.ru"
}

Or like form-data: key => value

I validate email field:

 $validator = Validator::make($request->all(), [
            'email' => 'required|email|string',
        ]);

It fails, cause $request is not contain email field.

If to do this:

   dd($request->all()); 

It gives me empty array [],

How to get POST field email?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire