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

删除会员


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

php
public function delete($id)
{
    $sku = $this->request->Model;
    return showSuccess($sku->delete());
}

模型 app/model/User.php

php
// 删除之后
   public static function onAfterDelete($user){
       $user->userInfo->delete();
   }

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

php
// 验证规则
protected $rule = [
    ...
    'id'=>'require|integer|>:0|isExist:User',
    ...
];

protected $scene = [
    ...
    'delete'=>['id'],
];

路由 router/admin.php

php
Route::post('user/:id/delete','admin.User/delete');