Laravel actually have "setIntendedUrl" and "intended" methods in the redirector to solve this exact problem: return redirect() ->setIntendedUrl(request()->fullUrl()) ->route('register'); Then after login, you can do this: return redirect()->intended('/');
This is exactly it! I knew that intended() alone did not last for multiple page redirections, but I did not know about setIntendedUrl. You learn something new everyday! 👀
This is the kind of content I feel like that brings so much value to developers: how to solve X (not being something too trivial, but also not too specific). It doesn't need to be THE best way to solving X, but it's some way. It is the reason I'm considering creating a YT channel to share the smartest solutions I came up with, during all my time working with Laravel.
Laravel actually have "setIntendedUrl" and "intended" methods in the redirector to solve this exact problem:
return redirect()
->setIntendedUrl(request()->fullUrl())
->route('register');
Then after login, you can do this:
return redirect()->intended('/');
This is exactly it! I knew that intended() alone did not last for multiple page redirections, but I did not know about setIntendedUrl. You learn something new everyday!
👀
@joshcirre I'm glad that was helpful.
I guess you have some refactoring to do.
😀😀😀
This is the kind of content I feel like that brings so much value to developers: how to solve X (not being something too trivial, but also not too specific). It doesn't need to be THE best way to solving X, but it's some way. It is the reason I'm considering creating a YT channel to share the smartest solutions I came up with, during all my time working with Laravel.
Great video Josh! Would you mind sharing which extension/setting you used to make the panel look like that at 3:47? Thanks!
@josh Great content as always! Just a note: I feel that there is a slight delay between the video and the audio.