您好我正在使用Laravel构建一个社交网络,但即使我登录它总是说密码错误但它是正确的我认为问题出现在以下代码部分, 请告诉我错误?
public function getsignin()
{
return view('auth.signin');
}
public function postsignin(Request $request)
{
$this->validate($request, [
'email'=>'required',
'password'=>'required'
]);
if( !Auth::attempt($request->only(['email','password']), $request->has('remember'))) {
return redirect()->back()->with('info','Whoops! Try again please...');
}
return redirect()->route('home')->with('info','Welcome!');
}
答案 0 :(得分:0)
尝试命名您的参数:
if( !Auth::attempt(['email' => $request->email, 'password' => $request->password], $request->has('remember'))) {
...
}
答案 1 :(得分:0)
if(!Auth::attempt(['email' => $request->email, 'password' => $request->password, $request->has('remember'))]) {
...
}
尝试时,您的参数必须是一个数组,并且您希望接受key =>值对的属性