Skip to main content
Since in a simple one-to-many tenancy implementation, each user only belongs to one tenant (team, organization, company, etc.), it may not be necessary to set up tenancy in Advanced Tables as each User View is already scoped to a user. However, if are allowing users to share views or if your tenant will have admins that can create Global Favorite Views, you will need to enable tenancy so that each User View will be scoped to the appropriate tenant.

Setting up simple tenancy with Filament Panels

  1. To set up simple tenancy with Filament Panels you will need to pass your Tenant::class to the ->tenant() method of the AdvancedTablesPlugin object:
    AdvancedTablesPlugin::make()
        ->tenant(Team::class)
    
  2. After you have configured your tenant model you may proceed to run the AddTenancy command:
    php artisan advanced-tables:add-tenancy
    
    This command will add and run the necessary migrations to finishing setting up multi-tenancy in Advanced Tables.

Setting up simple tenancy with Filament’s standalone Table Builder

  1. To set up simple tenancy with Filament’s standalone Table Builder you will need to add your Tenant::class to your advanced-tables.php config file:
    'tenancy' => [
        'tenant' => App\Models\Team::class,
    ],
    
  2. Inside your tenant model you need to include a getTenantId() method so Advanced Tables knows which tenant to use for its scopes:
    class Team extends Model
    {
        public function getTenantId(): ?string
        {
            return auth()->user()?->team_id;
        }
    }
    
  3. After you have configured your tenant model and the getTenantId() method, you may proceed to run the AddTenancy command:
    php artisan advanced-tables:add-tenancy
    
    This command will add and run the necessary migrations to finishing setting up multi-tenancy in Advanced Tables.