Redirect to custom page after registration

Posted 4 months ago by timgavin

My registration page has two buttons, one with the value foo and one with bar. I want to send the new user to a dynamic page after registration; users who clicked the foo button will go to /foo and users who clicked the bar button will go to /bar

protected function redirectTo(Request $request)
    {
        
        if($request->usertype == 'foo') {
            return '/foo';
        }

        return '/bar';
    }

Should be straightforward, but it's not working. I'm either getting a message Too few arguments to function App\Http\Controllers\Auth\RegisterController::redirectTo(), 0 passed

I tried passing $data from my validators method, but that doesn't work either.

What am I doing wrong?

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