如何在laravel智能登录???
如何登录以便任何用户登录系统不允许同一个用户同时登录后另一个地方怎么办。
答案 0 :(得分:1)
请去 vendor / laravel / framework / src / Illuminate / Foundation / Auth / AuthenticatesAndRegistersUsers.php app / 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