PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Monday, July 25, 2022

[FIXED] How to convert Laravel DB data into a suitable JSON form to use it in vuejs

 July 25, 2022     json, laravel, naming-conventions, object, vue.js     No comments   

Issue

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 ?


Solution

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



Answered By - Zrelli Majdi
Answer Checked By - Clifford M. (PHPFixing Volunteer)
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing