我正在尝试以管理员身份登录,并且我定义了警卫,但验证器中有一个错误,即validator()必须是158行中的类型数组。
BranchController:
public function authenticateBranchAdmin(Request $request){
$validator = Validator($request, [
Line 158-> 'email' => 'required|email',
'password' => 'required'
]);
if($validator->passes()){
if(Auth::guard('branch')->attempt([
'email' => $request->email,
'password' => $request->password,
])){
return redirect('/branch'.'/'.Auth::guard('branch')->id);
}else{
if($this->AdminIsVerified($request->email)){
$request->session()->flash('message', 'Invalid email or password!');
}else{
$request->session()->flash('message', 'Please Register this Account!');
}
return redirect('/Admin/login');
}
}else{
return redirect('/Admin/login')->withErrors($validator)->withInput();
}
}
答案 0 :(得分:0)
您需要将$request
转换为array
,array
需要Validator
,因此$request
代替$request->all()
。< / p>