我在 Laravel 上使用 API 的查询构建器执行此操作$shipments = DB::table('shipment_batches') ->select( "shipments.id as shipment_id", "shipments.fulfillment_id", "shipments.shipped_address_id", "shipments.courrier_id", "shipments.status", "shipments.is_intro", "shipments.is_express", "shipments.shipment_batch_id", "shipments.intro_shipment_date", "shipments.intro_shipped_at", "shipments.tracking_number", "shipments.is_gift", "shipments.ship_unit", "shipments.shipment_notes", "shipments.is_one_time_product", "shipments.one_time_product_shipment_date", "shipments.one_time_product_shipped_at", "shipments.shipment_options", "shipments.is_migrated", "shipments.migration_has_error", "shipments.in_process_date", "shipments.shipment_date_at", "shipments.link", ) ->join('shipments', 'shipments.shipment_batch_id', '=', 'shipment_batches.id') ->join('fulfillments', 'fulfillments.id', '=', 'shipments.fulfillment_id') ->join('subscriptions', 'subscriptions.id', '=', 'fulfillments.subscription_id') ->whereMonth('shipment_batches.shipment_date', '>', date('m')) ->whereYear('shipment_batches.shipment_date', '=', date('Y')) ->where('subscriptions.user_id', $id) ->orderBy('shipment_batches.id', 'ASC') ->get();我只是删除了其他数组返回值以简化集合。并在 API 上作为 json 返回之前添加hashed_id并padded_id修改结果我收到这个错误未定义的属性:stdClass::$id是否可以从查询构建器中创建集合?如何?
2 回答
- 2 回答
- 0 关注
- 196 浏览
添加回答
举报
0/150
提交
取消