0

I am building an app that I require that after a user successfully logins goes to a page if a session var is NOT set where based on some input data from the user this session var will be filled. After this I will pass the intended url to window.location.href in JS to redirect. So far I can only find responses as how to add

protected $redirectTo = “/something”

Can someone share some light please.

Johan H.
  • 157
  • 3
  • 14
  • See this, hope it helps!: https://stackoverflow.com/questions/42177044/laravel-5-4-redirection-to-custom-url-after-login – Hiren Gohel Feb 21 '18 at 05:41
  • Do you need a JS redirect? Like after success AJAX or so... –  Feb 21 '18 at 07:32
  • Setup a middleware to check for the session and then wrap a Route::group() around all routes that require authentication. – Option Feb 21 '18 at 11:30

1 Answers1

0

Thank you @Hiren Gohel I was trying to do the same solution pointed on your link but I forgot to add return before the redirect. the following code works

protected function authenticated(Request $request, $user) {
    return redirect('/setup');
}

on Auth/LoginController.php

Johan H.
  • 157
  • 3
  • 14