I use a common httpRequest to login, so I could use Redirect::intended();
to lead the user to a url before them being lead to the login page. That all works well.
Now I've changed login to ajax request I can only redirect the url in javascript now. So I've to pass the intended url to front end then do the window.location=url
The problem is I can't get the intended/origina
l url. Can any kind laravel expert help me out ?
location = $intended_url; Alternatively, you may setup a View Composer so whenever the login view/form is displayed the intended url will be available in that view and you can do it using this: View::composer('login', function($view){ $intended_url = Session::get('url.
Official Laravel documentation describes it like this: The intended method on the redirector will redirect the user to the URL they were attempting to access before being intercepted by the authentication middleware.
In Laravel 5.7:
$url = redirect()->intended()->getTargetUrl();
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With