Advice: How to access "related" models in a different database

I am using stancl/tenancy to provide a multi-tenant application with multi-database tenancy.

I have two panels, one for Admins, and one for Tenants. From the Admin panel I have access to a Tenant Resource, however, I'd like to then be able to access the "related" models from that Tenant's database:

This can be achieved by running a query within the Tenant's context, with either
$tenant = // The current Tenant Model

// and then
tenancy()->initialize($tenant);
User::query();

// or:
// @var $user ?User
$users = null
$tenant->run(function () use ($users) {
    $users = User::query();
});


i'm looking for some advice on how best to achieve this, "The Filament Way". Do I:
  • Create a Page, within the TenantResource /tenant/{id}/user. Then use "custom" infolists on these pages?
  • Is there a way to create a "faux" RelationshipManger?
  • another way I'm ignorant to?
thanks, and sorry for the "advice" question, I'm fairly new to Filament world and just wanna make sure I'm not missing anything along the journey.
Was this page helpful?