PHP code example of jeffersongoncalves / filament-teams

1. Go to this page and download the library: Download jeffersongoncalves/filament-teams library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

jeffersongoncalves / filament-teams example snippets


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;
}

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'),
        ]);
}

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',
    ],
];
bash
php artisan vendor:publish --tag="teams-migrations"
php artisan migrate
bash
php artisan vendor:publish --tag="teams-config"