2017-01-28 39 views
0

如何智能登錄laravel?如何在laravel中智能驗證登錄5.3

如何登錄,以便任何用戶登錄系統不允許同一用戶在同一時間登錄後如何做另一個地方。

+2

歡迎來到StackOverflow。請提供一個[Minimal,Complete,and Verifiable](http://stackoverflow.com/help/mcve)示例,顯示您正在嘗試使用的實際代碼,並解釋其中不適用於您的代碼。 – Frits

回答

1

請到 供應商/ laravel /框架/ src目錄/照亮/基金/認證/ AuthenticatesAndRegistersUsers.php應用程序/ MyAuthAndRegistersUsers.php

比流是

public function postLogin(Request $request) 
    { 
     $this->validate($request, [ 
      'username' => 'required', 'password' => 'required', 
     ]); 

     $credentials = $request->only('username', 'password'); 

     if ($this->auth->attempt($credentials, $request->has('remember'))) 
     { 
      return redirect()->intended($this->redirectPath()); 
     } 

     return redirect($this->loginPath()) 
      ->withInput($request->only('username', 'remember')) 
      ->withErrors([ 
       'username' => $this->getFailedLoginMessage(), 
      ]); 
    } 

你可以在這裏閱讀更多 https://laracasts.com/discuss/channels/requests/laravel-5-middleware-login-with-username-or-email