dscbxou1900343 2018-07-01 18:02
浏览 165

无法在laravel中进行身份验证

I have this error in Laravel latest for authentication

Argument 2 passed to Illuminate\Auth\SessionGuard::__construct() must be an instance of Illuminate\Contracts\Auth\UserProvider, null given, called in G:\xampp\htdocs ewrestaurantcrm\vendor\laravel\framework\src\Illuminate\Auth\AuthManager.php

can anyone give me an idea about this error why this error is occurring? I am using below code for authentication in my Auth\AuthController.php file

protected function login(Request $request) {
    $email = $request->email;
    $password = bcrypt($request->password);
    if (Auth::login(['email' => $email, 'password' => $password])) {
        return redirect()->intended('/admin/dashboard');
    }
}
  • 写回答

2条回答 默认 最新

  • dongwei1855 2018-07-01 18:21
    关注

    When you are authenticate user against email and password then use Auth::attempt or Auth::once (For single request). When we have user instance and we want to login with that user instance then we use Auth::login. For your case use Auth::attempt like this

    public function login(Request $request) {
        $email = $request->email;
        $password = bcrypt($request->password);
        if (Auth::attempt(['email' => $email, 'password' => $password])) {
            return redirect()->intended('/admin/dashboard');
        }
    }
    

    Details: https://laravel.com/docs/5.6/authentication#included-authenticating

    评论

报告相同问题?

悬赏问题

  • ¥15 装 pytorch 的时候出了好多问题,遇到这种情况怎么处理?
  • ¥20 IOS游览器某宝手机网页版自动立即购买JavaScript脚本
  • ¥15 手机接入宽带网线,如何释放宽带全部速度
  • ¥30 关于#r语言#的问题:如何对R语言中mfgarch包中构建的garch-midas模型进行样本内长期波动率预测和样本外长期波动率预测
  • ¥15 ETLCloud 处理json多层级问题
  • ¥15 matlab中使用gurobi时报错
  • ¥15 这个主板怎么能扩出一两个sata口
  • ¥15 不是,这到底错哪儿了😭
  • ¥15 2020长安杯与连接网探
  • ¥15 关于#matlab#的问题:在模糊控制器中选出线路信息,在simulink中根据线路信息生成速度时间目标曲线(初速度为20m/s,15秒后减为0的速度时间图像)我想问线路信息是什么