feat: #20220802 规格商品查看接口

This commit is contained in:
赵世界 2022-08-02 20:15:57 +08:00
parent 4e7d24e015
commit 2d59a6f9da

View File

@ -32,7 +32,11 @@ class GoodsSkusController extends Controller
public function show($id) public function show($id)
{ {
return new GoodsSkuResource(GoodsSku::query()->with(['goods', 'brand'])->find($id)); return new GoodsSkuResource(GoodsSku::query()
->with(['goods' => function ($query) {
$query->with(['type:id,name', 'brand:id,name']);
}])
->find($id));
} }
public function update($id, Request $request) public function update($id, Request $request)
@ -41,7 +45,7 @@ class GoodsSkusController extends Controller
$this->validateUpdate($data); $this->validateUpdate($data);
$sku = GoodsSku::query()->find($id); $sku = GoodsSku::query()->find($id);
$this->setBeforeUpdate($sku->toArray()); $this->setBeforeUpdate($sku->toArray());
$sku->save($data); $sku->update($data);
$this->setAfterUpdate($sku->toArray()); $this->setAfterUpdate($sku->toArray());
$this->addLog($id, 'update'); $this->addLog($id, 'update');