Change the backpack_url dynamically #1344
Replies: 2 comments
-
🚨 Bot is not sure about this answer. Please verify. 🚨 I'm sorry, but the knowledge sources do not contain explicit information on how to dynamically set the backpack_url() helper based on the tenant in a multi-tenant setup using a path-based approach (e.g., /app/{tenant}/dashboard). However, there are some related discussions and official answers about customizing Backpack's route prefix and using Backpack with multi-tenancy. For example, you can change the route prefix in config/backpack/base.php, and you can group Backpack routes under a custom prefix, but there is no direct mention of dynamically changing backpack_url() per tenant or integrating it with a tenancy package like Stancl Tenancy in the provided sources. If you need to have Backpack URLs include the tenant slug (e.g., /app/foo/dashboard), you would likely need to customize the route group and possibly override the backpack_url() helper to be tenant-aware. But, again, the exact steps or code for this are not covered in the knowledge sources above. For more details on multi-tenancy, there is a suggestion to look at the Spatie multitenancy package, but no implementation details are provided for Backpack specifically in this context is there anyone tried backpack with multitenant implementation ?. If you need to customize Backpack's routes, you can do so by editing the route group in your routes/backpack/custom.php and adjusting the prefix as needed, but dynamic per-request changes are not documented in the sources provided Customize the routes. In summary: ℹ️ Please note our AI Bot does not reply to follow-ups, this will be the only AI answer in this thread. If the AI helped you find the answer, please mark it as answered or write details below so it can learn. Then close the conversation. If not, please give more information for when a human reads this. ℹ️ Relevant sources: How to setup second admin panel under the same domain but another path? |
Beta Was this translation helpful? Give feedback.
-
Hello @smzapp I didn't use that package early, but I guess the best way is using subdomain and then control it overriding the function for backpack_url I found there is a discussion about this package where you can find some useful info #733 Cheers. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi everyone, I am using tenancy on my laravel app. Now, I get the tenant via slug.
How could I set the backpack_url dynamically based on the tenant?
For instance, after login, http://localhost:8000/login, it should redirect to a specific tenant
and set it as backpack_url(), example
backpack_url = http://localhost:8000/app/foo/dashboard
Effect:
When I visited
http://localhost:8000/app/foo/more-page
, the css and script has a problem in loading due to the base url. Upon viewing source, the host is not displayed correctly.Beta Was this translation helpful? Give feedback.
All reactions