I am using a query that returns value perfectly but it adds key number to the collection. How can I remove the index number?
Here is the retrieved data
You have to do it manually
$users=\App\User::get()->toArray(); // your query here $data['data']=[]; foreach($users as $user ){ $data['data'][]=$user; } $k=json_encode($data); dd($k);