relationshipmanager for belongsToMany relationship with pivot table tries to insert into wrong table

Hey guys might there be any reason that a relation manager tries to insert into the relation table instead of the pivot table?

I currently have usersrelationmanager that is tied to courseresource. my course and users do have many-to-many relationship with a pivot table. inside usersrelationmanager, i have my relationship set to 'users', but when i try to add a new student for a course, it tries to insert an item to the users table...
class UsersRelationManager extends RelationManager
{
    protected static string $relationship = 'users';

    protected static ?string $modelLabel = 'Student';

    protected static ?string $title = 'Enroll Students';

    protected static ?string $recordTitleAttribute = 'id';

    public static function form(Form $form): Form
    {
        return $form
            ->schema([
                Select::make('user_id')
                    ->label('Student')
                    ->required()
                    ->options(function (RelationManager $livewire): array {
                        // code to get the users
                    })
                    ->searchable(),
            ]);
    }


when i try to create a new entry, the realtionshipmanager tries to insert into the users table instead of user_courses table
image.png
Was this page helpful?