mercredi 26 septembre 2018

Laravel API Middleware Return JSON all request

My controllers that respond to api request, all respond with data that should be transformed into JSON.

Instead of using json_encode() in every controller, I would like to use middleware to just wrap the response. Since these routes for the API are already protected with the auth:api middleware which from what I have read is defined within the core of Laravel.

How would I go about adding a method to that middleware that would do all the json processing for me? could



from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/2NEFwyB
via IFTTT

Aucun commentaire:

Enregistrer un commentaire