Laravel Spark redirect on registration

763 views Asked by At

I am simply trying to redirect a user to a page when they register. I have accomplished this redirect when the user logs in by altering the following line in the LoginController in vendors/laravel/Spark/src/Http/Controllers/Auth

protected $redirectTo = '/Profile/';

In attempting to do the same thing for the registration, I altered the same line in the RegisterController at the same address. However, that did not work.

I traced the code down to the RedirectsUsers trait which first looks for the redirectPath property and then for the redirectTo property. So it seems like this should work.

However, I get redirected to 'undefined' which would seem to indicate that the 'redirectTo' variable is either protected somewhere that it should not be or is simply missing. The variable is present in the authController for laravel.

1

There are 1 answers

0
B. Schop On

If you want to change the redirect after you have logged in or registered a new user add the following line to your booted() function in App/Providers/SparkServiceProvider.php

Spark::afterLoginRedirectTo('example');