Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/241.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/mysql/69.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 如何使用用户名检查电话号码和密码以输入我的帐户?laravel8x_Php_Mysql_Authentication_Controller_Laravel 8 - Fatal编程技术网

Php 如何使用用户名检查电话号码和密码以输入我的帐户?laravel8x

Php 如何使用用户名检查电话号码和密码以输入我的帐户?laravel8x,php,mysql,authentication,controller,laravel-8,Php,Mysql,Authentication,Controller,Laravel 8,当客户想要登录到他的帐户时,我希望系统使用用户名检查电话号码和密码。我怎样才能在laravel8x中做到这一点 这是我的代码 $credentials = Client::where('username', '=', $request->username)->first(); if(!$credentials){ return back()->with('fail','You are not our client'); } else

当客户想要登录到他的帐户时,我希望系统使用用户名检查电话号码和密码。我怎样才能在laravel8x中做到这一点

这是我的代码

    $credentials = Client::where('username', '=', $request->username)->first();

    if(!$credentials){
      return back()->with('fail','You are not our client');
    }
    else{
        if([(Hash::check($request->password, $credentials->password))] && [check($request->phonenumber, $credentials->phonenumber)]){

          $request->session()->put('LoggedUser', $credentials->id);
          return redirect('client/dashboard');




        }
        else {
          return back()->with('fail','Wrong password');
        }
    }

  }

我找到了。我必须在第二个if中创建if函数。如果您自己已经找到了解决方案,请清楚地说明问题所在,并说明解决方案的代码。目前,你的回答含糊不清,对未来的读者毫无价值。