Level 1
@wilk_randall can you please help, would be really great, thanks!
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
so here is my table for educational resources:-
id(int(250))
class_id(int(250))(foreign key)// we get this from classroom table
teacher_id(int(250))(foreign key)// we get this from user table for users who have the role of teacher.
material_title(varchar(250)).
Here is how the educational resources table would look like:-
id class_id teacher_id material title
1 1 1 test1
2 1 2 test2
3 2 3 test3
4 2 4 test4
Now the thing I want to do here is that students in the class with id "1" should be able to see both test1 and test2 but not test 3 and test4, students in class with id "2" should be able to see both test3 and test4 but not test1 and test2. Also teacher with id "1" should be only able to see test1 and similarly for others. How do I accomplish this in laravel relationships and controller?
Please or to participate in this conversation.