This is not any essential element in this tutorial, but may be you forget to add a screenshot after this paragraph
Filament 4 comes with multi-tenancy support out of the box: the screenshot below shows how you can switch between teams/companies, see on the top-left:
I will use seperate DB for handling tenants data. I want to use this package -> https://github.com/archtechx/tenancy I have seen the tutorial of Multi tenancy from this site.
Do you have more tutorials, blog post where I can see some more info to make filament compatible with this tenancy package (for seperate DB)?
Here is my use case: Multiple companies as tenants and each user belongs to one company (users.company_id FK). Each company can have multiple teams (user belongs to many teams).
Here is how I plan to solve it:
Global scope on company level (company_id in almost every table, trait Companiable).
Filament multitenancy on team level. (I'm using filament).
FilamentShield for user/team roles and permissions.
Am I thinking in the right direction? Am I overengineering maybe?
Sorry for late reply Dejan. With these cases, it's hard to answer without actually implementing that solution and trying it out in action, and debugging.
My approach was to create the relationship in userResource because the User model has a companies relationship and the rest have a company relationship. For some reason, ->tenant(Company::class) wasn't enough and always gave an error because the companies were different from the company relationship. I left the code as it was and added this to UserResource:
protected static ?string $tenantOwnershipRelationshipName = 'companies';
Hi, i use this in Filament 3; https://laraveldaily.com/post/multi-tenancy-laravel-filament-simple Does it also work in Filament 4, basically the same way?
yes, it will work
This is not any essential element in this tutorial, but may be you forget to add a screenshot after this paragraph
Filament 4 comes with multi-tenancy support out of the box: the screenshot below shows how you can switch between teams/companies, see on the top-left:
I will use seperate DB for handling tenants data. I want to use this package -> https://github.com/archtechx/tenancy I have seen the tutorial of Multi tenancy from this site.
Do you have more tutorials, blog post where I can see some more info to make filament compatible with this tenancy package (for seperate DB)?
Here is my use case: Multiple companies as tenants and each user belongs to one company (users.company_id FK). Each company can have multiple teams (user belongs to many teams). Here is how I plan to solve it: Global scope on company level (company_id in almost every table, trait Companiable). Filament multitenancy on team level. (I'm using filament). FilamentShield for user/team roles and permissions. Am I thinking in the right direction? Am I overengineering maybe?
Sorry for late reply Dejan. With these cases, it's hard to answer without actually implementing that solution and trying it out in action, and debugging.
My approach was to create the relationship in userResource because the User model has a companies relationship and the rest have a company relationship. For some reason, ->tenant(Company::class) wasn't enough and always gave an error because the companies were different from the company relationship. I left the code as it was and added this to UserResource: protected static ?string $tenantOwnershipRelationshipName = 'companies';