Saltar al contenido
← Volver a proyectos

Filament Teams

A Filament plugin that adds multi-tenancy with Teams, memberships, and team invitations to your panels.

Filament Teams

#Filament Teams

Buy Me A Coffee

Latest Version on Packagist GitHub Tests Action Status GitHub Code Style Action Status Total Downloads License

A Filament plugin that adds multi-tenancy with Teams, memberships, and team invitations to your panels. It builds on the framework-agnostic jeffersongoncalves/laravel-teams core (models, migrations, policy and the HasTeams trait) and adds the Filament layer on top: a HasTeamsFilament trait for your User model, tenant registration and profile pages, an invitation acceptance flow, and optional admin resources to manage Teams and Team Invitations.

#Features

  • 🏢 Multi-tenancy backed by a Team model
  • 👥 Team memberships through a pivot model
  • ✉️ Team invitations with accept / cancel flow
  • 🪪 Personal team automatically created for every new user
  • 🧩 HasTeamsFilament trait wiring all Filament tenancy contracts
  • 🛠️ Optional admin resources for Teams and Team Invitations
  • ⚙️ Configuration and migrations provided by jeffersongoncalves/laravel-teams (models, tables and guard are configurable)

#Compatibility

Plugin Version Filament
1.x ^3.0
2.x ^4.0
3.x ^5.0

#Installation

You can install the package via composer (the jeffersongoncalves/laravel-teams core is pulled in automatically):

composer require jeffersongoncalves/filament-teams:"^3.0"

You can publish and run the migrations with:

php artisan vendor:publish --tag="teams-migrations"
php artisan migrate

You can publish the config file with:

php artisan vendor:publish --tag="teams-config"

#Usage

#1. Prepare your User model

Add the HasTeamsFilament trait and implement the Filament tenancy contracts on your User model. Your users table needs a current_team_id column (provided by the published migration).

use Filament\Models\Contracts\FilamentUser;
use Filament\Models\Contracts\HasDefaultTenant;
use Filament\Models\Contracts\HasTenants;
use Illuminate\Foundation\Auth\User as Authenticatable;
use JeffersonGoncalves\Filament\Teams\Concerns\HasTeamsFilament;

class User extends Authenticatable implements FilamentUser, HasDefaultTenant, HasTenants
{
    use HasTeamsFilament;
}

#2. Register the plugin

use JeffersonGoncalves\Filament\Teams\FilamentTeamsPlugin;

public function panel(Panel $panel): Panel
{
    return $panel
        ->plugins([
            FilamentTeamsPlugin::make()
                ->tenancy()            // enable tenant config (default: true)
                ->invitations()        // register the invitation acceptance page (default: true)
                ->resources()          // register the Teams & Team Invitations admin resources (default: false)
                ->tenantRoutePrefix('team'),
        ]);
}

The plugin will automatically configure the panel tenant model, tenant registration page, tenant profile page, and the tenant middleware.

#Configuration

return [
    'guard' => 'web',
    'user_model' => 'App\\Models\\User',
    'personal_teams' => true,
    'models' => [
        'team' => \JeffersonGoncalves\Teams\Models\Team::class,
        'team_invitation' => \JeffersonGoncalves\Teams\Models\TeamInvitation::class,
        'membership' => \JeffersonGoncalves\Teams\Models\Membership::class,
    ],
    'tables' => [
        'teams' => 'teams',
        'memberships' => 'membership',
        'team_invitations' => 'team_invitations',
    ],
];

#Testing

composer test

#Changelog

Please see CHANGELOG for more information on what has changed recently.

#Contributing

Please see CONTRIBUTING for details.

#Security Vulnerabilities

Please review our security policy on how to report security vulnerabilities.

#Credits

#License

The MIT License (MIT). Please see License File for more information.

Nueva versión disponible.