F
Filament11mo ago
morty

When using multi-tenancy, is there a way to remain on the current resource when switching tenant?

Currently, when switching tenants, it defaults back to the dashboard screen. Can it remain on the current resource instead?
4 Replies
shenntek
shenntek10mo ago
i'm interested in this as well. found were u can change it, should override the component i think: components/tenant-menu.blade.php
<x-filament::dropdown.list.item
:href="route(Route::currentRouteName(), ['tenant' => $tenant->id])"
:image="filament()->getTenantAvatarUrl($tenant)"
tag="a"
>
{{ filament()->getTenantName($tenant) }}
</x-filament::dropdown.list.item>
<x-filament::dropdown.list.item
:href="route(Route::currentRouteName(), ['tenant' => $tenant->id])"
:image="filament()->getTenantAvatarUrl($tenant)"
tag="a"
>
{{ filament()->getTenantName($tenant) }}
</x-filament::dropdown.list.item>
and from what i read it's discouraged to change views in filament. so a PR should be made.
shenntek
shenntek10mo ago
GitHub
preserve current url when switching tenant if current user can acce...
This PR adds functionality to preserve the current page/url when changing to another tenant.
johnnie_littleshoes
@shenntek Good job on that PR, sad that it won't be accepted
toeknee
toeknee3mo ago
I was just going to build a similar function so very handy @shenntek @morty @johnnie_littleshoes This is a quick improvement both performance and sticking to current resource if in a model item when switching too. I will try and look to make a more efficent core PR outside of the view at some point in the future. Added as a pr comment.
Want results from more Discord servers?
Add your server