Repeater and pivot table

Hi, I'm facing an issue with Repeater and a BelongsToMany Relationship.

Here's my Project model :
class Project extends Model
{
  public function members(): BelongsToMany
  {
    return $this->belongsToMany(User::class);
  }
}


My pivot table, called "project_user", has a "project_role" column.

Then I have in my EditProject (App\Filament\Resources\ProjectResource\Pages\EditProject) the following Repeater :
Repeater::make('members')->schema([ 
  
  Select::make('user_id')->label('Member email')->options(User::all()->pluck('email', 'id'))->searchable()->required(), 

  Select::make('project_role')->options(...)->required() 
])->createItemButtonLabel('Add member')


I'd like the "project_role" select to automatically fill this pivot column, however it does not work, it tries to fill my "users" table.

Any idea?
Was this page helpful?