© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
FilamentF
Filament•13mo ago•
1 reply
mmoollllee

Tenancy with other packages Model

I have a existing filament project used across multiple projects.
So I'm trying to add tenancy functionality now to manage all projects within one instance.
I have some CMS functionality with a
Page
Page
Model in a extra package/plugin.
My tenant Model is
Project
Project
.

To add the tenancy awarenes I
1. add the foreignId project_id to the pages migration
2. add HasMany pages() to the
Project
Project
Model
3. add the relation with the following from a ProjectRelationServiceProvider.php
Page::resolveRelationUsing('project', function ($model) {
    return $model->belongsTo(Project::class, 'project_id');
});
Page::resolveRelationUsing('project', function ($model) {
    return $model->belongsTo(Project::class, 'project_id');
});


Is this the right approach to add tenancy awarenes to a Model coming from another package?
Filament banner
FilamentJoin
A powerful open source UI framework for Laravel • Build and ship admin panels & apps fast with Livewire
20,307Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

Tenancy Model Scoping Best Practices
FilamentFFilament / ❓┊help
6mo ago
Tenancy Check in Model Policy
FilamentFFilament / ❓┊help
2y ago
Multi tenancy model without owner
FilamentFFilament / ❓┊help
2y ago
hasAvatars other model
FilamentFFilament / ❓┊help
3y ago