6
0
Fork 0
release
panliang 2022-06-01 15:53:52 +08:00
parent 1b44673f05
commit d657a68aec
1 changed files with 2 additions and 5 deletions

View File

@ -26,10 +26,7 @@ class PartController extends Controller
$part = ProductPart::where('key', $key)->first(); $part = ProductPart::where('key', $key)->first();
} }
$paginator = ProductPartSku::with('sku:id,name,cover,sell_price,vip_price,market_price') $paginator = ProductPartSku::with('spu:id,name,cover,sell_price,vip_price,market_price')
->whereHas('sku', function ($query) {
return $query->online();
})
->when($part, function ($query, $part) { ->when($part, function ($query, $part) {
$query->where('part_id', $part->id); $query->where('part_id', $part->id);
}, function ($query) { }, function ($query) {
@ -40,7 +37,7 @@ class PartController extends Controller
return ProductSkuTinyResource::collection( return ProductSkuTinyResource::collection(
$paginator->through(function ($item) { $paginator->through(function ($item) {
return $item->sku; return $item->spu;
}) })
); );
} }