erhsaikhasif's avatar

How to get only array from query result?

Hello , When I execute query i get result with array, But the array contains some additional result that i dont want, see this screenshot when i do print_r() http://prntscr.com/di0ycy. When I echo response()->json($result); it show json stringwith header info >> http://prntscr.com/di0yps Please give me a solution for this.

0 likes
1 reply
merlin334's avatar
Level 10

Have you tried to add ->toArray() to the end of the query:

$result = User::get()->toArray();

return response()->json($result));

It seems to me that you get a collection.

Please or to participate in this conversation.