You can use registered method as described here: https://github.com/laravel/framework/issues/16423
Apr 23, 2018
2
Level 2
Redirecting to intended URL after registration
I have a fairly basic application that is using the register method that ships with Laravel. I've come up with a solution to redirect users to their intended url after registration (i.e. they try to get a user only area, they are redirected to that area after registration), but I wanted to see if there was a more 'Laravel' way to do it. The solution I came up with is this:
Auth\RegisterController
class RegisterController extends Controller {
protected function redirectTo()
{
if (session('url.intended')) {
return session('url.intended');
}
return '/';
}
...
}
I've seen suggestions of using redirect()->intended('/'), but that doesn't work with the redirectTo method that you can use with Laravel's out-of-the-box registration.
Like I said, my code works, but I'm just wondering if there's a more 'Laravel' way of doing it, if I'm missing something, etc.
Please or to participate in this conversation.