我有一张表offers
,购买的商品有id
。该项目存储在另一个表items
中。在回复GET
请求时,我想通过购买返回完整的商品对象。我该怎么做呢?
public function getBuys(Request $request)
{
$usr_id = $request->input('usrid');
$buys = Offer::where('buyer_id', '=', $usr_id)->get();
return response()->json($buys);
}