Skip to content
Advertisement

Getting rid of numbers in a json response ( LARAVEL 9 )

i’m having some problems with my json response.

When I make an api call from a user (id:1) it returns the response well, but if i change the user (f.e id:2) it returns it with some identifiers on it. Any idea?

Response from id:1

JavaScript

Response from id:2

JavaScript

Thanks!

EDIT 1

This is how I am getting the response:

JavaScript

Advertisement

Answer

Right now, you’re getting all of the results, then filtering the collection returned, instead of having the database do the work for you. Instead, grab only a single row.

JavaScript

To get all the rows that match, then you need

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