On this page
删除单张图片
控制器 app/controller/admin/Image.php
php
public function delete($id)
{
$image = $this->request->Model;
return showSuccess($image->delete());
}
验证器 app/validate/admin/Image.php
php
// 验证规则
protected $rule = [
...
'id'=>'require|integer|>:0|isExist:Image',
...
];
protected $scene = [
...
'delete'=>['id'],
];
路由 router/admin.php
php
Route::delete('image/:id','admin.Image/delete');