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

[4.x] Route name prefixing and tenant parameter passing #252

Open
lukinovec opened this issue Jul 19, 2023 · 0 comments
Open

[4.x] Route name prefixing and tenant parameter passing #252

lukinovec opened this issue Jul 19, 2023 · 0 comments

Comments

@lukinovec
Copy link
Collaborator

When using path or query string identification with other packages, the links retrieved by route() (e.g. Jetstream views) or temporarySignedRoute() (e.g. Livewire file uploads) in tenant context don't get the tenant parameter – they point to the central app (e.g. 'app.test/home' instead of 'app.test/{tenant}/home'). By enabling UrlBindingBootstrapper, we can deal with that by overriding the UrlGenerator instance with our custom generator (TenancyUrlGenerator).

The custom generator has the $prefixRouteNames static property which toggles prefixing of route names passed to route() (e.g. route('foo') calls route('tenant.foo') when $prefixRouteNames is true).

You can also pass the bypass parameter (route('foo', ['central' => true]); the bypass parameter is 'central' by default) to skip overriding the mentioned methods.

Edge case: when using path identification in the global stack, you'll need to use the custom generator, but you might also want to use a different identification method on the route level (for example, domain identification). The links you see when visiting the route will be broken – they will link to 'app.test/{tenant}/home' instead of 'tenant-domain.test/home'.

https://discord.com/channels/976506366502006874/976513756576243733/1131092283975008326

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

No branches or pull requests

1 participant