$.ajax({
url: "your/route",
type: "POST",
headers: {
"Content-Type": "application/json"
},
data: JSON.stringify([{"id":13,"user":1,"product":4},{"id":4,"user":8,"product":4},{"id":6,"user":90,"product":23}]),
success: function (result) {
console.log(result);
}
});
Assuming you are submitting an ajax request with the above settings and data, you can easily go through it in your controller like:
foreach ($request->all() as $data){
// your code here.
// You can access each item's data like: $data->id, $data->user etc.
}
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…