Issue displaying & editing pivot field (role) in multi-tenant UserResource

Hi, I’m working on a multi-tenant Laravel Filament app with companies and users in a many-to-many relationship.
The pivot table is company_user and contains a role field.

I’ve set up my UserResource like this:
protected static ?string $tenantOwnershipRelationshipName = 'companies';

This correctly filters users to the current tenant.

In my table, I want to show name, email, and role:
Tables\Columns\TextColumn::make('name'),
Tables\Columns\TextColumn::make('email'),
Tables\Columns\TextColumn::make('role'),

name and email display fine, but role does not show.
I expected it to work like how relationship managers handle pivot fields.

Models

User model:

public function companies(): BelongsToMany
{
    return $this->belongsToMany(Company::class)
        ->withPivot(['role'])
        ->withTimestamps();
}


Company model:

public function users(): BelongsToMany
{
    return $this->belongsToMany(User::class)
        ->withPivot(['role'])
        ->withTimestamps();
}


Form fields in UserResource:

Forms\Components\TextInput::make('name')
    ->required()
    ->maxLength(255),

Forms\Components\TextInput::make('email')
    ->email()
    ->required()
    ->maxLength(255),

Forms\Components\Select::make('role')
    ->required()
    ->default(CompanyRole::Admin)
    ->options(CompanyRole::class),


The problems I’m facing:
  1. In the table, role does not display.
  2. When creating a user, Filament inserts data into the pivot table but ignores the value from the role select — it always uses the DB default (member).
  3. When editing a user, the form loads name and email, but does not load the current role from the pivot table.
How can I correctly display, load, and save a pivot field (role) in this UserResource with multi-tenancy enabled?
Was this page helpful?