In controller:
public function index(Request $request, $id) {
if (!empty($id)) {
$product = product::select('name', 'price', 'quantity')
->where('id', $id)
->get()->toArray();
return response()->json($product);
}
}
In Vue, I use Axios to get data.
axios
.get("/api/product", {
params: {
id: id,
},
})
.then((res) => {
this.rows = res.data;
})
.catch((error) => {
console.log(error);
});
It shows the list okay But I want it not to get all the data..but by pagination, one-click on pagination it will load 30 items. Give me ideas, thanks.