F
Filament2mo ago
flex

School-Class-Manager Usability-Problem

Let's imagine we have tool to manage school classes. Each school class has many students, documents, timetables, events and a lot more. All further tables have a school_class_id. At the moment I see two options to make them managable in Filament: 1) All resources are linked in the filament menu. Problem: Clicking on students for exmaple would list all students of all classes. 2) I only link school classes in the menu and all other resources I show in the detail-view of the school class. But if we now we have the scenario, that a teacher normally manages one school class at once, it would be awesome to set the current active school class (beside the avatar in filament for example) and clicking on "Students" in the menu only shows students of this active school class by default. Is this possible with filament?
Solution:
Then you can add a second layer with a BelongsToMany for schools in the teacher model You can even create two different panels, one for the school owners with tenancy on schools to manage teachers and one with tenancy on teachers to manage classes This could work quite well but will add a lot of complexity Something that could be more simple would be to use policies well configured and query scoping...
Jump to solution
4 Replies
skyrowl
skyrowl2mo ago
that looks like you need to implement tenancy, one tenant could be a class and each teacher have many tenants (classes) take a look here https://filamentphp.com/docs/3.x/panels/tenancy
flex
flexOP2mo ago
Hm, in general you are right depending on my description. But the problem is, the system may handles multiple schools (tenants).
Solution
skyrowl
skyrowl2mo ago
Then you can add a second layer with a BelongsToMany for schools in the teacher model You can even create two different panels, one for the school owners with tenancy on schools to manage teachers and one with tenancy on teachers to manage classes This could work quite well but will add a lot of complexity Something that could be more simple would be to use policies well configured and query scoping
flex
flexOP2mo ago
That are awesome hints. I will play around with it a bit. Thank you very much
Want results from more Discord servers?
Add your server