6
0
Fork 0
base
panliang 2023-03-17 22:15:56 +08:00
parent 1fc2505b82
commit 47afe5b6a8
1 changed files with 3 additions and 2 deletions

View File

@ -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未上架');