I have the following JSON object returned from Laravel query:
Laravel code:
$users = DB::table('orders')
->where('custid','=', $cid)
->orderBy('id', 'desc')
->get();
[{"id":37,"date":"2016-11-30 19:16:30","status":"Processing","prodid":"23","custid":"46","created_at":"2016-11-30 19:16:30","updated_at":"2016-11-30 19:16:30"},
{"id":36,"date":"2016-11-30 18:59:29","status":"Processing","prodid":"23","custid":"46","created_at":"2016-11-30 18:59:29","updated_at":"2016-11-30 18:59:29"}]
I want to store the 'id' of each entry to a php array. I tried the following:
JSON_decode($users,TRUE);
To decode the JSON into a PHP associative array but I keep getting error 500. Any work arounds?
JSON_decode($users[0],TRUE);?/storage/logs/laravel.log