Answer the question
In order to leave comments, you need to log in
Is it possible to use camelCase instead of snake_case in Laravel APIResource and in server requests?
I'm starting to develop an API service on Laravel. The customer asks to use camelCase field names in api json (responses/requests) instead of the standard snake_case!
But the problem is that Laravel uses snake_case as a standard (in pagination fields, database fields, API Resource classes (even if the connection method in the model is written in camelCase - in the response, Resource will turn the field name into snake_case).
In general, is there a possibility without alteration and "shit code" to solve this issue, or will it be correct to use snake_case and convince the customer of this?
Answer the question
In order to leave comments, you need to log in
Can. Redefine ->toArray() in the paginator, mb in a few more places and that's enough.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question