F
Filamentβ€’2y ago
Sander

Different resources on central/tenant domain using stancl/tenancy

Hello! I'm using stancl/tenancy with Filament admin and i'm trying to figure out how to have a different set of resources/pages/widgets for for the central domain and the tenant domains. Is it possible to have as structure like this: App/Filament/Central/(pages, resources, widgets) App/Filament/Tenant/(pages, resources, widgets) And load the correct path conditionally based on the current context? Any help would be much appreciated!
22 Replies
Sander
SanderOPβ€’2y ago
Is this doable? I was also thinking about using policies, but the above would make things a lot more easy. Has anyone a idea?
Dan Harrin
Dan Harrinβ€’2y ago
maybe #multi-context in v3 this is basically built-in
IndomieRendang
IndomieRendangβ€’2y ago
Will it include multitenant database (each tenant has separate db) ?
Dan Harrin
Dan Harrinβ€’2y ago
uh no i dont like that structure lol its often used by people who overthink performance, they forget that databases were built to scale to millions of rows
IndomieRendang
IndomieRendangβ€’2y ago
Oh no... "its often used by people who overthink performance" πŸ‘ˆ you're right πŸ˜”
Dan Harrin
Dan Harrinβ€’2y ago
yup πŸ˜‚ just do a team_id or tenant_id column you think google has a database for each of its users?
IndomieRendang
IndomieRendangβ€’2y ago
Yes, currently I use this... I was thinking that the db will be very tired searching and filtering for "user_id" over and over again... πŸ˜΅β€πŸ’«
Dan Harrin
Dan Harrinβ€’2y ago
well its much better than separate databases use a global scope if you dont want to filter over and over
IndomieRendang
IndomieRendangβ€’2y ago
Yes I use global scope... well, many thanks... I think this thread must back to the owner's topic... πŸ‘Œ
Sander
SanderOPβ€’2y ago
Thanks for both your input! Never seen #multi-context think this will do it. Thanks.
Dennis Koch
Dennis Kochβ€’2y ago
Not sure about stancl/tenancy, but have a look at #multi-context Oops, the other messages only loaded now πŸ˜…πŸ™ˆ
IndomieRendang
IndomieRendangβ€’2y ago
Is #multi-context reliable? Maybe you're using it
Dennis Koch
Dennis Kochβ€’2y ago
I haven't had the need for it so far
nostrodamned
nostrodamnedβ€’2y ago
Just to jump in here! I am actually using multidb (stancl) and there is a valid reason for GDPR and compliance Reasons. Just some of my thoughts maybe why it is worth a rethink over the performance aspect. 1. Multi Db/Tenant allows me to regionalise my data so clients comply with data compliance etc. (EU DB Server & US DB Server also Australia, Asia all have diiferent laws regarding data storage) 2. 1 database goes down i don't lose the entire platform. 3. Simplification of data separation. 4. Ability to easily offer export of data for end user. 5. Easy to manage data migration for enterprise clients who want customisation. I do understand there is workarounds but multidb can be extremely useful. Just my 2 cents πŸ˜„ @danharrin @Dennis Koch Hi @Sander , I do exactly this using laravel modules
Dan Harrin
Dan Harrinβ€’2y ago
yeah those are very valid reasons, i think theres a point in an enterprise environment where its worth it, but for people starting out it probably isnt. is that fair?
nostrodamned
nostrodamnedβ€’2y ago
I think the biggest thing even for non enterprise is the regional issue, If we are making an app we have to comply with EU and US laws, and for us it is essential to split the databases to have compliance.But that being said i do get that for many that is not an issue as they wont be marketing globally, but i dont think its a small percentage that it impacts not to have multidb
Dan Harrin
Dan Harrinβ€’2y ago
yeah but regionalising the db doesnt mean that everyone needs their own db, you can still have multiple tenants in one db its much more complex to have to provision separate databases regionally on demand
nostrodamned
nostrodamnedβ€’2y ago
Agreed! It could be done with 1 db in each region, i think though there is still advantages to the data segregation at a tenant level - its just my use case though and makes life easier as there is almost zero chance of tenant data crossover.
Sander
SanderOPβ€’2y ago
Thanks @cvc_web will look into Laravel modules! @danharrin Are you saying that this is "natively" possible in V3? If so i'll wait for V3 as i'm still building the Tenant side admin/functionality.
Dan Harrin
Dan Harrinβ€’2y ago
yes there is tenancy in v3, but you can still build your app in v2 and then migrate later the rest of your app should take the most time to build so you should still do that
Sander
SanderOPβ€’2y ago
Thanks, alright, can you confirm the dynamic resource path part? πŸ™‚ ping @danharrin
Dan Harrin
Dan Harrinβ€’2y ago
yes
Want results from more Discord servers?
Add your server