Skip to content
Advertisement

Laravel controller store data received in camel case format

I’m working with multiple controllers where I receive inputs in camel case format and I need to assign these properties to a model:

JavaScript

The problem is that my model has around 30 properties and I don’t want to write them one by one. I know that I can use the request to get all the properties:

JavaScript

Is there a way to convert match the properties in camel case format with the database standard equivalent? Something like the inverse of camel method:

JavaScript

Advertisement

Answer

Use

JavaScript

more https://laravel.com/docs/8.x/helpers#method-snake-case

User contributions licensed under: CC BY-SA
1 People found this is helpful
Advertisement