To my understanding, Redirect::intended()
will redirect to a users intended page prior to logging in, or fall back to a url that can be passed as an argument.
My question is this: How would I make it so that it first checks if there is an intended url in the session, if not it does a Redirect::back()
instead, and if that fails it will redirect to the users profile which would be the same as Redirect::route('users.show', Auth::user()->username);
Notes:
Partially, the behavior you expected can be attained by passing the referer to
Redirect::intended
as parameter thereferer
.The rest depends on the criteria of a
Redirect::back
failure as you meant it.Answer:
Here is my take