$arrList = [];
foreach ($product as $val) {
$arrList[]['name'] = $val->name;
$arrList[]['quantity'] = $val->quantity;
}
return response()->json($arrList);
I am a PHP newbie, so I'm not sure how to handle this. I want the name and quantity to be in the same array.
To the Vue side get the same result?
(2) [{…}, {…}, {…}, {…}, {…}, {…}, __ob__: Observer]
0:
name: iphone
quantity: 100
1:
name: samsung
quantity: 130
from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/3ljmzAS
via IFTTT
Aucun commentaire:
Enregistrer un commentaire