【问题标题】:Lumen 5.1 Auth::attempt Not workingLumen 5.1 Auth::attempt 不工作
【发布时间】:2018-06-24 01:55:56
【问题描述】:

我正在使用lumen 5.1.*,但每当我使用 Auth 时,它都会抛出错误

AuthManager.php 第 16 行中的 ErrorException:缺少参数 1 Illuminate\Auth\AuthManager::createDriver(),调用 D:\xampp\htdocs\project\vendor\illuminate\support\Manager.php 上线 87和定义

谁能帮我解决这个问题。我需要在流明中使用Auth::user()

public function postLogin(Request $request){


       if (Auth::attempt(['email' => $request->email, 'password' => $request->password])) {
            // Authentication passed...
            echo "success";
            echo "<pre>";
            print_r(Auth::user()->toArray());
        } else {
            echo "sorry erorr occured";
        }
    }

【问题讨论】:

  • 你的Auth::attempet(); 在哪里?我可以看看吗?
  • @EtibarRustemzade.我更新了问题
  • if (Auth::attempt(['email' =&gt; $request-&gt;email, 'password' =&gt; $request-&gt;password, 'activated' =&gt; 1])); 你检查了吗?
  • @ya 不工作,甚至 auth::user() 也不工作
  • auth()-&gt;user(); 辅助函数在流明中工作

标签: php laravel laravel-5 lumen


【解决方案1】:

设置您的.env 文件然后检查

lumen-api-oauth/.env.example

【讨论】:

猜你喜欢
  • 2017-03-10
  • 2014-06-20
  • 1970-01-01
  • 2016-07-19
  • 1970-01-01
  • 2014-08-31
  • 2015-12-14
  • 2013-02-27
相关资源
最近更新 更多