Php 如何使用用户名检查电话号码和密码以输入我的帐户?laravel8x
当客户想要登录到他的帐户时,我希望系统使用用户名检查电话号码和密码。我怎样才能在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
$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函数。如果您自己已经找到了解决方案,请清楚地说明问题所在,并说明解决方案的代码。目前,你的回答含糊不清,对未来的读者毫无价值。