|
|
@ -64,7 +64,12 @@ class AgentProductController extends Controller |
|
|
} else { |
|
|
} else { |
|
|
$where = ['id' => $id, 'agent_id' => $this->agent_id, 'status' => ProductStatus::ON_SALE]; |
|
|
$where = ['id' => $id, 'agent_id' => $this->agent_id, 'status' => ProductStatus::ON_SALE]; |
|
|
} |
|
|
} |
|
|
$agent_product = AgentProduct::with(['coupon:tag,agent_product_id', 'product.spec']) |
|
|
|
|
|
|
|
|
$agent_product = AgentProduct::with([ |
|
|
|
|
|
'coupon:tag,agent_product_id', |
|
|
|
|
|
'product' => function($query) { |
|
|
|
|
|
$query->select('id')->with('spec'); |
|
|
|
|
|
} |
|
|
|
|
|
]) |
|
|
->whereDoesntHave('agentProductItem', function ($query) { |
|
|
->whereDoesntHave('agentProductItem', function ($query) { |
|
|
return $query->whereHas('product', function ($query) { |
|
|
return $query->whereHas('product', function ($query) { |
|
|
return $query->where('stock', '<=', 0)->orWhere('status', '<>', ProductStatus::ON_SALE); |
|
|
return $query->where('stock', '<=', 0)->orWhere('status', '<>', ProductStatus::ON_SALE); |
|
|
|