On this page
修改图片名称
控制器 app/controller/admin/Image.php
php
public function update(Request $request, $id)
{
return showSuccess($request->Model->save([
'name'=>$request->param('name')
]));
}
验证器 app/validate/admin/Image.php
php
// 验证规则
protected $rule = [
// ...
'id'=>'require|integer|>:0|isExist:Image',
'name'=>'require|NotEmpty',
];
protected $scene = [
...
'update'=>['id','name'],
];
路由 router/admin.php
php
Route::post('image/:id','admin.Image/update');