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

[1.x] Adds custom redirects after creating or deleting a team #383

Merged
merged 1 commit into from
Oct 23, 2020

Conversation

thisiskj
Copy link
Contributor

Problem

In the application I'm developing, I would like the user to be redirected to a specific page after creating or deleting a team. Currently when a new team is created or deleted, the user is redirected to path defined by the fortify.home configuration variable.

Solution

In Laravel (without Jetstream) this is accomplished by implementing the redirectTo() method or a $redirectTo property on the LoginController, ResetPasswordController, etc...

My proposal is to allow customization of the redirects by allowing a redirectTo() method or a $redirectTo property on the following actions.

  • CreatesTeams
  • DeletesTeams

The consuming controllers would look for the existence of redirectTo() on the action and use it, otherwise default to fortify.home.

@driesvints driesvints changed the title Adds custom redirects after creating or deleting a team [1.x] Adds custom redirects after creating or deleting a team Oct 23, 2020
@taylorotwell taylorotwell merged commit 6449631 into laravel:1.x Oct 23, 2020
@thisiskj thisiskj mentioned this pull request Oct 23, 2020
@jaulz
Copy link
Contributor

jaulz commented Jan 7, 2021

@thisiskj thanks for the PR, this sounds like what I need but I am not yet sure how I can properly use it. Could you please give me a quick hint?

@thisiskj
Copy link
Contributor Author

thisiskj commented Jan 9, 2021

@jaulz Sure, in the CreateTeams or DeletesTeams actions, you can just define a property named $redirectTo and give it the route. Something like this:

class CreateTeams
{

    public $redirectTo = '/my/route';

    ...
}

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

Successfully merging this pull request may close these issues.

3 participants