I want to redirect back to where the user has been, after he logs out successfully, because I have methods that are accessible even if logged out.
I guard every method in my PhotosController except @show
public function __construct()
{
$this->middleware('auth', ['except' => 'show']);
}
To set the redirect after logout I set the property in my AuthController like this:
protected $redirectAfterLogout = '/customLogoutPage';
But I want to redirect the user back to where he has been, since he can see the View even without being locked in.
I tried something in this direction:
protected $redirectAfterLogout = redirect()->back();
But my browser says: "Unexpected '(', expecting ',' or ';'
How is it possible to use a redirect back to the view where the user has been, before he logged out.