vendredi 25 novembre 2016

Laravel Validation redirect after ajax call

I have a fresh 5.3 installation and want to make api calls with postman.

In my routes/api.php I got a simple route:

Route::post('test', function(\App\Http\Requests\LoginRequest $request) {
    return $request->all();
});

LoginRequest is checking if the fields email and password are there. If so, the output is as excepted. But when it's missing it redirects to /.

Do I have to add some information for form validation for ajax calls? I thought laravel would return a json error object when there is an ajax call.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire