如何在laravel 5.3中智能验证登录

时间:2017-01-28 04:05:45

标签: laravel-5

如何在laravel智能登录???

如何登录以便任何用户登录系统不允许同一个用户同时登录后另一个地方怎么办。

1 个答案:

答案 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