Problem Overriding Login Trait

Posted 7 months ago by ldslaracasts

I am attempting to have laravel deny login to a user unless the 'approved' switch is flipped in the database. I have added an authenticate method. The code executes, it gets in to the second if loop, but somehow it always redirects the user to home instead of login. Appreciate any help.

public function authenticate(Request $request)
    if (Auth::attempt(['email' => $request->input('email'), 'password' => $request->input('password')])) {
        if (Auth::user()->approved != 1) {
            return redirect()
    return redirect()->route('home');

Please sign in or create an account to participate in this conversation.