F
Filamentβ€’13mo ago
droppysee08

Filament 3 with Stancl/Tenancy

Hey everyone, has anyone tried using Filament 3 with multiple databases and exclusively for tenants? I'm facing an issue where I want to use Filament 3 in tenants and create a separate Filament panel for the central domain. I attempted to set it up in the central domain, but when I tried to use it in a tenant and added 'PreventAccessFromCentralDomains' on the tenant panel, the styles and assets disappeared. Has anyone encountered a similar problem or found a solution for this?
14 Replies
Lara Zeus
Lara Zeusβ€’13mo ago
Gist
Full Guide for Multi-tenancy with tenancy with laravel package
Full Guide for Multi-tenancy with tenancy with laravel package - multi-tenancy.md
droppysee08
droppysee08OPβ€’13mo ago
Thanks for that. How about the filament? my goal is to use filament in tenant.
Lara Zeus
Lara Zeusβ€’13mo ago
GitHub
filament integration with Tenancywithlaravel Full Guide Article by...
a step by step guide which will take your application from single user to multi-tenant application
droppysee08
droppysee08OPβ€’13mo ago
No description
droppysee08
droppysee08OPβ€’13mo ago
here is the result when using with the tenant, assets/style does not load properly. But when using the filament with the central domain it works.
Lara Zeus
Lara Zeusβ€’13mo ago
from the docs https://tenancyforlaravel.com/docs/v3/tenancy-bootstrappers/#filesystem-tenancy-boostrapper You can disable tenancy of asset() in the config (tenancy.filesystem.asset_helper_tenancy) and explicitly use tenant_asset() instead. tenant_asset() always returns a path to the TenantAssetController: tenant_asset('foo.txt') returns your-site.com/tenancy/assets/foo.txt. You may want to do that if you're facing issues using a package that utilizes asset() inside the tenant app.
Tenancy for Laravel
Tenancy bootstrappers | Tenancy for Laravel
Tenancy bootstrappers | Tenancy for Laravel
ianclemence
ianclemenceβ€’13mo ago
Hey πŸ‘‹ were you able to fix this?
droppysee08
droppysee08OPβ€’13mo ago
No, I still haven't fixed it. I don't know if I will continue to use Filament with Stancl/Tenancy. I can't find a way to use Filament with both the central and tenant databases in Stancl. I've been trying to figure it out for almost a week, but I haven't had any luck yet. by the way i am using multidatabases
ianclemence
ianclemenceβ€’13mo ago
I was able to fix it by heading over to the tenancy.php file in the config directory and set asset_helper_tenancy to false
droppysee08
droppysee08OPβ€’13mo ago
oh nice i will try it. thanks
return $panel
->id('tenant')
->path('/tenant')
->login()
->colors([
'primary' => Color::Amber,
])
->discoverResources(in: app_path('Filament/Tenant/Resources'), for: 'App\\Filament\\Tenant\\Resources')
->discoverPages(in: app_path('Filament/Tenant/Pages'), for: 'App\\Filament\\Tenant\\Pages')
->pages([
Pages\Dashboard::class,
])
->discoverWidgets(in: app_path('Filament/Tenant/Widgets'), for: 'App\\Filament\\Tenant\\Widgets')
->widgets([
Widgets\AccountWidget::class,
Widgets\FilamentInfoWidget::class,
])
->middleware([
InitializeTenancyByDomain::class,
PreventAccessFromCentralDomains::class,
EncryptCookies::class,
AddQueuedCookiesToResponse::class,
StartSession::class,
AuthenticateSession::class,
ShareErrorsFromSession::class,
VerifyCsrfToken::class,
SubstituteBindings::class,
DisableBladeIconComponents::class,
DispatchServingFilamentEvent::class,
])
->authMiddleware([
Authenticate::class,
]);
return $panel
->id('tenant')
->path('/tenant')
->login()
->colors([
'primary' => Color::Amber,
])
->discoverResources(in: app_path('Filament/Tenant/Resources'), for: 'App\\Filament\\Tenant\\Resources')
->discoverPages(in: app_path('Filament/Tenant/Pages'), for: 'App\\Filament\\Tenant\\Pages')
->pages([
Pages\Dashboard::class,
])
->discoverWidgets(in: app_path('Filament/Tenant/Widgets'), for: 'App\\Filament\\Tenant\\Widgets')
->widgets([
Widgets\AccountWidget::class,
Widgets\FilamentInfoWidget::class,
])
->middleware([
InitializeTenancyByDomain::class,
PreventAccessFromCentralDomains::class,
EncryptCookies::class,
AddQueuedCookiesToResponse::class,
StartSession::class,
AuthenticateSession::class,
ShareErrorsFromSession::class,
VerifyCsrfToken::class,
SubstituteBindings::class,
DisableBladeIconComponents::class,
DispatchServingFilamentEvent::class,
])
->authMiddleware([
Authenticate::class,
]);
When i add the InitializeTenancyByDomain::class, PreventAccessFromCentralDomains::class, i get error, "Tenant could not be identified on domain test" Thanks i figure it out now, in panel middleware, the PreventAccessFromCentralDomains::class does not need,
awcodes
awcodesβ€’13mo ago
GitHub
filamentphp.com/content/articles/multi-tenancy-implementation-with-...
Source code for the filamentphp.com website. Contribute to filamentphp/filamentphp.com development by creating an account on GitHub.
droppysee08
droppysee08OPβ€’13mo ago
Nice nice, Ill check it out.
Dennis Koch
Dennis Kochβ€’13mo ago
It's the same guide as mentioned above, right?
awcodes
awcodesβ€’13mo ago
yep. sorry. missed the previous link. πŸ™‚
Want results from more Discord servers?
Add your server