Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make redirects more flexible #204

Open
obuchmann opened this issue Aug 23, 2024 · 1 comment
Open

Make redirects more flexible #204

obuchmann opened this issue Aug 23, 2024 · 1 comment

Comments

@obuchmann
Copy link

We currently have an application with 3 different user types and views. Therefore we would like to determine the redirect route based on some logic. It would be nice if we could hook into the redirect determination with an event or something like the existing TakeImpersonation events:

Event::listen(function (TakeImpersonation $event) {
            ...
        });
@geowrgetudor
Copy link

You don't have to use the routes or events at all. You can simply do something like this:

app('impersonate')->take(auth()->user(), $modelOfTheUserYouWantToImpersonate);

return redirect()->route($modelOfTheUserYouWantToImpersonate->redirectRoute());

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants