store
parent
1fc2505b82
commit
47afe5b6a8
|
|
@ -12,6 +12,7 @@ use App\Endpoint\Api\Http\Resources\ProductFeatureResource;
|
|||
use App\Events\ProductSkuViewed;
|
||||
use App\Models\Store\Desk;
|
||||
use App\Endpoint\Api\Http\Resources\DeskResource;
|
||||
use App\Exceptions\BizException;
|
||||
|
||||
class StoreController extends Controller
|
||||
{
|
||||
|
|
@ -67,8 +68,8 @@ class StoreController extends Controller
|
|||
$spu = $store->productSpus()->with(['specs', 'features'])->findOrFail($id);
|
||||
|
||||
$sku = $store->productSkus()
|
||||
->where('product_spu_id', $spu->id)
|
||||
->when($request->filled('sku_id'), fn($q) => $q->where('product_sku_id', $request->input('sku_id')))
|
||||
->wherePivot('product_spu_id', $spu->id)
|
||||
->when($request->filled('sku_id'), fn($q) => $q->wherePivot('product_sku_id', $request->input('sku_id')))
|
||||
->first();
|
||||
if (!$sku) {
|
||||
throw new BizException('商品sku未上架');
|
||||
|
|
|
|||
Loading…
Reference in New Issue