2017-05-13 62 views
0

ERROR: enter image description here驗證器必須是類型的陣列中laravel5.3

我試圖登錄爲管理員,我所限定的警衛但在驗證器)的錯誤校驗(必須是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

您需要$request轉換爲array,如arrayValidator預期,所以不是$request使用$request->all()

相關問題