Hiding duplicate foreign keys when doing a left join
I have 3 tables
1)question
2)category
3)moderator
The question table has foreign key references for both category and moderator id.
What want to do is to show all the questions along with the moderators and category name as title(once) before all the questions belonging to that category.How do i hide the category and moderator except the first which will display before all questions for the category
e.g
category:food
moderator:jack
Q1,Q2 ... Qn
category:animals
moderator:james
Q1,Q2 ... Qn
Note:English is not my first language ask clarification.
@markzimmer If I get it right you have one moderator per category, right? Why would you need a reference to moderator table in questions then? And also you should try to follow laravel naming conventions. Something like this:
categories id|moderator_id|name
moderators id|name
questions id|category_id|question
Afterwards, you can take a look at Eloquent relations to see how can you set up relations properly, and then you can write the code I mentioned above