产品详情页添加品牌信息
This commit is contained in:
parent
8384db4911
commit
4f5b2821e6
|
|
@ -34,7 +34,7 @@ class ProductRepo
|
|||
if (is_int($product)) {
|
||||
$product = Product::query()->findOrFail($product);
|
||||
}
|
||||
$product->load('description', 'skus', 'master_sku');
|
||||
$product->load('description', 'skus', 'master_sku', 'brand');
|
||||
return $product;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -125,10 +125,13 @@ class SettingRepo
|
|||
/**
|
||||
* 创建或更新单条记录
|
||||
*
|
||||
* @param $data
|
||||
* @param $name
|
||||
* @param $value
|
||||
* @param string $space
|
||||
* @param string $type
|
||||
* @throws \Throwable
|
||||
*/
|
||||
public static function storeValue($name, $value, $space = 'base', $type = 'system')
|
||||
public static function storeValue($name, $value, string $space = 'base', string $type = 'system')
|
||||
{
|
||||
if (in_array($name, ['_method', '_token'])) {
|
||||
return;
|
||||
|
|
|
|||
|
|
@ -22,6 +22,7 @@ class ProductController extends Controller
|
|||
$data = [
|
||||
'product' => (new ProductDetail($product))->jsonSerialize(),
|
||||
];
|
||||
$data = hook_filter('product.show', $data);
|
||||
return view('product', $data);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -25,6 +25,8 @@ class ProductDetail extends JsonResource
|
|||
'id' => $this->id,
|
||||
'name' => $this->description->name ?? '',
|
||||
'description' => $this->description->content ?? '',
|
||||
'brand_id' => $this->brand->id ?? 0,
|
||||
'brand_name' => $this->brand->name ?? '',
|
||||
'images' => array_map(function ($image) {
|
||||
return [
|
||||
'preview' => image_resize($image, 500, 500),
|
||||
|
|
|
|||
Loading…
Reference in New Issue