I have the model Student
Student
- groups : BelongsToMany
and model Group
Group
- students: HasMany
of course there is a pivot table group_student with
group_id student_id
I am trying, in Filament3, to set up a StudentRelationManager , so that I can add students to a group , with the table (not with select )
I ran this command
php artisan make:filament-relation-manager GroupResource students student_id
and of course added the relation
public static function getRelations(): array
{
return [
RelationManagersStudentsRelationManager::class
];
}
but the minute a click on edit on a given Group record
which is wrong because the student doesnt belong to just one group, but could be in many, so it doesnt have a group_id, but depends on the pivot table : group_student
Instead of something like this
What I am missing ? how to make it work ? can this be achieved ? I searched but could nt find other than fixing it with selects .
Please advice