Step-by-Step Guide to Filament Multi-Tenancy

  Рет қаралды 10,650

Tuto1902

Tuto1902

Күн бұрын

Пікірлер: 43
@Tuto1902
@Tuto1902 Жыл бұрын
WARNING *** PLEASE READ *** 17:00 Tenant middleware no longer goes inside the ->middleware() section. This will result in Filament::getTenant() returning null. Instead, now you need to use the ->tenantMiddleware() function. Here's the documentation link so you can read all about it: filamentphp.com/docs/3.x/panels/tenancy#using-tenant-aware-middleware-to-apply-global-scopes
@jadersbr
@jadersbr Ай бұрын
Thanks for share 🥇
@Tuto1902
@Tuto1902 20 күн бұрын
No problem 👍
@shaungbhone8368
@shaungbhone8368 2 ай бұрын
Thank you very much. You save my day. Can you show me the database?
@Tuto1902
@Tuto1902 2 ай бұрын
Here's the entire code, including database migrations github.com/tuto1902/filament-multi-tenancy
@HamadAbdulla_7
@HamadAbdulla_7 Жыл бұрын
Thank you😍
@Tuto1902
@Tuto1902 Жыл бұрын
It is my absolute pleasure. I’m glad you find it helpful
@FindWebX
@FindWebX Жыл бұрын
If the Jetstream Team, is similar to this? Thank you very much for valuable video❤❤❤
@Tuto1902
@Tuto1902 Жыл бұрын
I appreciate you watching and I'm glad you find it helpful.
@wakathepublic
@wakathepublic 9 ай бұрын
can you make import excel, csv or another file for handling user in multi tenant ?
@Tuto1902
@Tuto1902 9 ай бұрын
I’ll make a note for it. Thanks for the suggestion
@ZAGAfrica
@ZAGAfrica Ай бұрын
No Github Repo because there are gaps especially in your DB
@Tuto1902
@Tuto1902 20 күн бұрын
Probably, I wasn't focused on DB but more on quick tenancy setup. If you can elaborate on the gaps you found, I would love to hear your feedback
@jensb5519
@jensb5519 6 ай бұрын
Nice and clear tutorial! But is it possible to combine this with the Filament Shield plugin?
@Tuto1902
@Tuto1902 6 ай бұрын
I think so. The way I see it, the shield plugin works as a second layer. First, can the user access the tenant. Second, what can the user do inside the tenant (Shield). I haven't tested this myself but I see no reason why it shouldn't work
@jonmason9024
@jonmason9024 Жыл бұрын
Is there a way to tap into whatever event is fired when a tenant is changed? I want to do something whenever a user changes the tenant, but can't find anything in the docs to see how to do it?
@Tuto1902
@Tuto1902 Жыл бұрын
I don't think there's a way to do that. At least none that I know of
@philately
@philately 6 ай бұрын
@@Tuto1902 Actually, there is. Every time a new tenant is set as "active" an Filament\Events\TenantSet is fired. You can register a listener to it and you're good to go.
@ruddra_nick_biswas
@ruddra_nick_biswas 5 ай бұрын
Hello Can you help me with this! I want to disable user to create new team! admin will create team for them! how can I achieve that kind of functionality ??
@Tuto1902
@Tuto1902 4 ай бұрын
Have you tried adding a TeamPolicy with a create() method? laravel.com/docs/11.x/authorization#policy-methods Filament will enforce any policy automatically.
@EvandroNeres-t8b
@EvandroNeres-t8b 2 ай бұрын
What VS extensions are you using?
@Tuto1902
@Tuto1902 2 ай бұрын
Catppuccin for VS Code, Catppuccin Icons and all the regular Intelephense extensions.
@tahinuralam29
@tahinuralam29 7 ай бұрын
How can I set the navigation bage count for the current tenant
@Tuto1902
@Tuto1902 7 ай бұрын
I would just follow the docs. All queries made on resources should be scoped to the current tenant filamentphp.com/docs/3.x/panels/navigation#adding-a-badge-to-a-navigation-item As long as the model has the tenant relationships properly configured, everything should work as expected filamentphp.com/docs/3.x/panels/tenancy#configuring-the-tenant-relationships
@WawangBprnbp
@WawangBprnbp Жыл бұрын
that's very helpful, thank you, but I'm having problems inputting customer data, do I have to add team_id to the customer table, and what should the relationship be like? I don't really understand how it works
@Tuto1902
@Tuto1902 Жыл бұрын
It all depends on what you’re trying to do. If your customers are going to belong to just one team, then yes. You need a team_id in the customers table and the relationship is One to Many (one team has many customers). But if the customer can have access to multiple teams, then you need a pivot table (customer_team) and the relationship is Many to Many
@WawangBprnbp
@WawangBprnbp Жыл бұрын
okay tanks@@Tuto1902
@augustocarvalhochavez3192
@augustocarvalhochavez3192 11 ай бұрын
I have a model called category but I would like it to be shown in all the authenticated user's teams since they can have several teams?
@Tuto1902
@Tuto1902 11 ай бұрын
Create a ManyToMany relationship between Category and Team. Keep in mind that filament will try to look for a relationship called team() in the Category model. But since you want a ManyToMany relationship, I would suggest a relationship called teams() and then modify the owner relationship name in the CategoryResource class protected static ?string $tenantOwnershipRelationshipName = 'teams';
@augustocarvalhochavez3192
@augustocarvalhochavez3192 11 ай бұрын
@@Tuto1902 Thank you very much for answering. So I edited the Resource and it worked for me. public static function getEloquentQuery(): Builder { $team_id= Auth::user()->teams->pluck('id'); return Category::whereIn('team_id', $team_id); }
@marianovallejos6542
@marianovallejos6542 11 ай бұрын
how solve nested relation ? All the tables need team_id record?
@Tuto1902
@Tuto1902 11 ай бұрын
If the records Belong To a single team, yes. If the records can Belong To Many different teams, then you need a pivot table and probably adjust the owner relationship name in the resource class filamentphp.com/docs/3.x/panels/tenancy
@rialmon
@rialmon 11 ай бұрын
Hi Tuto, thank you very much for this tutorial! I have a question, would you like to help me?. I'm facing this error: SQLSTATE[42S02]: Base table or view not found: 1146 Table 'db_name.team_user' doesn't exist. How do i fix it?
@rialmon
@rialmon 11 ай бұрын
Tuto, i've just found the solution: i only needed to create a pivot table named team_user, by executing "php artisan make:migration create_team_user_table"; then i put into the schema both $table->integer('user_id') and $table->integer('team_id'); then, finally, i run the migration.
@Tuto1902
@Tuto1902 11 ай бұрын
That works, but this doesn't enforce the foreign keys in the database. I would recommend using $table->foreignIdFor(App\Models\User::class) and $table->foreignIdFor(App\Models\Team::class). This creates the appropriate indexes and makes the table more read efficient.
@1234321marty
@1234321marty Жыл бұрын
How about global scope in model, can I still use it selected tenant instead of middlawere in resource?
@Tuto1902
@Tuto1902 Жыл бұрын
Yeah, that works too. I forgot to mention that option. That way you don’t need to fiddle with the panel configuration and it will give you the same results
@joeyboli
@joeyboli Жыл бұрын
Did it work for you, it doesnt work for me
@proskillscenter9589
@proskillscenter9589 4 ай бұрын
are this method support multi domains ?
@Tuto1902
@Tuto1902 2 ай бұрын
Nope, this only covers single domain multi-tenancy.
NEW in Filament 3: Multi-Tenancy
12:14
Laravel Daily
Рет қаралды 17 М.
Multi-tenant Architecture for SaaS
11:07
CodeOpinion
Рет қаралды 121 М.
How To Choose Mac N Cheese Date Night.. 🧀
00:58
Jojo Sim
Рет қаралды 94 МЛН
Accompanying my daughter to practice dance is so annoying #funny #cute#comedy
00:17
Funny daughter's daily life
Рет қаралды 15 МЛН
Как Я Брата ОБМАНУЛ (смешное видео, прикол, юмор, поржать)
00:59
Натурал Альбертович
Рет қаралды 4,4 МЛН
А я думаю что за звук такой знакомый? 😂😂😂
00:15
Денис Кукояка
Рет қаралды 4,3 МЛН
16 Laravel Filament Multi-Tenancy - FilamentPHP V3 Tutorial
23:53
Multi-tenancy in Laravel
1:24:05
JustSteveKing
Рет қаралды 7 М.
Learnings from our multi-tenant Laravel application
9:58
Sabatino Develops
Рет қаралды 17 М.
Filament Tables with Livewire: Full Page Component! ✨
22:45
17 Laravel Filament Multiple Panels - FilamentPHP V3 Tutorial
19:16
Tmux From Scratch To BEAST MODE
12:44
DevOps Toolbox
Рет қаралды 127 М.
Laravel 11: Multi-Tenancy with Multiple Databases
8:23
Laravel Daily
Рет қаралды 20 М.
FilamentPHP Quotes & Invoices
2:07
Njuguna Mwangi
Рет қаралды 1,4 М.
How To Choose Mac N Cheese Date Night.. 🧀
00:58
Jojo Sim
Рет қаралды 94 МЛН