mirror of
https://gitee.com/hzchunfen/erp.git
synced 2025-11-30 22:20:45 +00:00
feat: #20220802 规格商品查看接口
This commit is contained in:
parent
4e7d24e015
commit
2d59a6f9da
@ -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');
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user