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

删除单张图片


控制器 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');