need to ask, currently i'm using laravel and db query builder to create the function below. Requirement is to get the query result without the bracket / object.
Function is below :
$score = DB::table('m_player_scorecard')
->where('session_id', '=', $sessionID)
->orderBy('created_at', 'desc')
->get();
$scoreArr = json_decode(json_encode($score), true);
return response()
->json($scoreArr);
when i try to hit from postman :
[
{
"id": 153,
"session_id": "9e3bb8296fd195c66ced470ec50301385f6cd31a17012e26fd0099bdf821338c",
"round_order": 2,
"player_one_id": 1,
"score_one": 10,
"player_two_id": 2,
"score_two": 10,
"player_three_id": 3,
"score_three": 30,
"player_four_id": 4,
"score_four": 40,
"notes": null,
"created_at": "2020-06-06 18:15:27",
"updated_at": null
},
{
"id": 152,
"session_id": "9e3bb8296fd195c66ced470ec50301385f6cd31a17012e26fd0099bdf821338c",
"round_order": 1,
"player_one_id": 1,
"score_one": 10,
"player_two_id": 2,
"score_two": 20,
"player_three_id": 3,
"score_three": 30,
"player_four_id": 4,
"score_four": 40,
"notes": null,
"created_at": "2020-06-06 18:14:39",
"updated_at": null
}
]
I need to remove the bracket [], only the result array. How to do that?
Thanks before
from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/2zeUnd6
via IFTTT
Aucun commentaire:
Enregistrer un commentaire