/**
  * 处理登录操作
  *
  * @return Response
  * @auther yangyifan <*****@*****.**>
  */
 public function postLogin(LoginFormRequest $request)
 {
     $login_status = AdminInfoModel::login($request->all());
     switch ($login_status) {
         case 1:
             return $this->response(200, trans('response.success'), [], true, url('admin/home'));
         case -1:
         case -3:
             return $this->response(401, trans('response.admin_not_exists'));
         case -2:
             return $this->response(401, trans('response.admin_disable'));
     }
     //登陆失败
     return $this->response(401, trans('response.unauthorized'));
 }
 /**
  * 用户退出
  *
  * @return Response
  * @auther yangyifan <*****@*****.**>
  */
 public function getLogout()
 {
     AdminInfoModel::logout();
     $this->response(200, trans('response.success'), [], true, url('admin/login'));
 }
 /**
  * 添加后台用户
  *
  * @param Request $request
  * @auther yangyifan <*****@*****.**>
  */
 public function postAdd(AdminInfoRequest $request)
 {
     $data = $request->all();
     $data['password'] = bcrypt($data['password']);
     //写入数据
     $affected_number = AdminInfoModel::create($data);
     return $affected_number->id > 0 ? $this->response(200, trans('response.add_success'), [], true, url('admin/admininfo/index')) : $this->response(400, trans('response.add_error'), [], false);
 }
 /**
  * 删除数据
  *
  * @param $id
  * @throws \Exception
  * @author yangyifan <*****@*****.**>
  */
 public function getDelete($id)
 {
     AdminInfoModel::del($id) > 0 ? $this->response(200, trans('response.delete_success'), [], false, url('admin/news/index')) : $this->response(400, trans('response.delete_error'), [], false);
 }