Method Illuminate\Auth\RequestGuard::attempt does not exist

前端 未结 2 1660
攒了一身酷
攒了一身酷 2021-02-19 07:06

I am new to both laravel and lumen. I was creating a login api with oauth2.0 in lumen 5.6, i have installed passport and generated token. Below is my login controller function a

2条回答
  •  深忆病人
    2021-02-19 07:38

    The function guard is only available for routes with web middleware

    public function login() {
    
      if(Auth::guard('web')->attempt(['email' => $email, 'password' => $password], false, false)) {requests
         // good
      } else {
        // invalid credentials, act accordingly
     }
    }
    

提交回复
热议问题