dimanche 19 février 2017

How to change response in Laravel?

I have RESTful service that is available by endpoints.

For example, I request api/main and get JSON data from server.

For response I use:

return response()->json(["categories" => $categories]);

How to control format of response passing parameter in URL?

As sample I need this: api/main?format=json|html that it will work for each response in controllers.



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

Aucun commentaire:

Enregistrer un commentaire