duandou2763 2016-10-27 09:16
浏览 23
已采纳

Laravel的Hash缺少论点?

I'm getting a weird error in Laravel 5.3's hash mechanism.

Missing argument 2 for Illuminate\Hashing\BcryptHasher::check(), called in C:\xampp\htdocs\Missionseek2\vendor\laravel\framework\src\Illuminate\Support\Facades\Facade.php on line 237 and defined

This is the code that defines it.

public function postSignIn(Request $request){

        $val = DB::table('ministry')->where('Username', Input::get('Username'))->first();

        if ($val && Hash::check(Input::get('Password', $val->Password))) {
            return redirect()->route('agencydash');
        } return 'failed';
       // if (Auth::attempt(['Username' => $request['Username'], 'Password' => $request['Password']])) {
       //     return redirect()->route('agencydash');
       // }
        //return redirect()->back();
    }

What's going on here? I feel like it's not getting the password value from the database and so we're getting an error, but I'm not sure why. The name's are correct.

  • 写回答

4条回答 默认 最新

  • dqz30992 2016-10-27 09:22
    关注

    You are passing 2 argument in Input::get() instead of check(). You have to correct brackets positions

    if ($val && Hash::check(Input::get('Password'), $val->Password))
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(3条)

报告相同问题?

悬赏问题

  • ¥15 vue3+element-plus页面崩溃
  • ¥15 像这种代码要怎么跑起来?
  • ¥15 怎么改成循环输入删除(语言-c语言)
  • ¥15 安卓C读取/dev/fastpipe屏幕像素数据
  • ¥15 pyqt5tools安装失败
  • ¥15 mmdetection
  • ¥15 nginx代理报502的错误
  • ¥100 当AWR1843发送完设置的固定帧后,如何使其再发送第一次的帧
  • ¥15 图示五个参数的模型校正是用什么方法做出来的。如何建立其他模型
  • ¥100 描述一下元器件的基本功能,pcba板的基本原理