Skip to content
关注公众号,获取新课通知

修改商品规格卡片


控制器 app/controller/admin/GoodsSkusCard.php

php
public function update(Request $request, $id)
{
    $param = $request->param();
    $res = $request->Model->save($param);
    return showSuccess($res);
}

验证器 app/validate/admin/GoodsSkusCard.php

php
// 验证规则
protected $rule = [
    'id'=>'require|integer|>:0|isExist',
	'goods_id'=>'require|integer|>=:0|isExist:Goods,false',
    'name'=>'require|NotEmpty',
    'type'=>'require|in:0,1,2',
    'order'=>'require|integer|>:0',	
];

protected $scene = [
    ...
    'update'=>['id','name','status','type','order'],
];

路由 router/admin.php

php
Route::post('goods_skus_card/:id','admin.GoodsSkusCard/update');