fixed active

This commit is contained in:
Edward Yang 2022-08-29 16:43:02 +08:00
parent 9b6d341ba2
commit c29cf811fc
2 changed files with 1 additions and 7 deletions

View File

@ -19,13 +19,6 @@ class ProductController extends Controller
public function show(Request $request, Product $product)
{
$product = ProductRepo::getProductDetail($product);
if ($product->active == 0) {
$data = [
'product' => (new ProductDetail($product))->jsonSerialize(),
'error' => trans('product.has_been_inactive')
];
return view('product', $data);
}
$data = [
'product' => (new ProductDetail($product))->jsonSerialize(),
];

View File

@ -36,6 +36,7 @@ class ProductDetail extends JsonResource
'variables' => $this->decodeVariables($this->variables),
'skus' => SkuDetail::collection($this->skus)->jsonSerialize(),
'in_wishlist' => $this->inCurrentWishlist->id ?? 0,
'active' => (bool)$this->active,
];
}