with($with)->where('advance_product_id', '=', $advance_product_id)->find(); } public function product() { return $this->belongsTo('app\\common\\model\\product\\Product', 'product_id', 'product_id'); } public function sku() { return $this->hasMany('app\\common\\model\\plus\\advance\\AdvanceSku', 'advance_product_id', 'advance_product_id'); } /** * 关联供应商 */ public function supplier() { return $this->belongsTo('app\\common\\model\\supplier\\Supplier', 'shop_supplier_id', 'shop_supplier_id'); } //查询预售商品详情 public static function getProductAdvanceDetail($product_id) { $detail = (new static)->with(['product.image.file', 'sku.productSku.image']) ->where('product_id', '=', $product_id) ->where('end_time', '>', time()) ->where('status', '=', 10) ->where('audit_status', '=', 20) ->where('is_delete', '=', 0) ->find(); return $detail; } }