Home > Software design >  How to convert Laravel DB data into a suitable JSON form to use it in vuejs
How to convert Laravel DB data into a suitable JSON form to use it in vuejs

Time:12-06

The attributes of laravel modal are named using underscore (_), for example :

first_name

but attributes of javascript objects are named with camelCase:

{ firstName: "..." }

And this presents a conflict, is there a solution to resolve it ?

CodePudding user response:

Try to use Laravel eloquent resource pattern will do that for You. Check this helpful documentation. https://laravel.com/docs/8.x/eloquent-resources

  • Related