Answer the question
In order to leave comments, you need to log in
How to make reviews for articles?
Database for the site: courses, articles, teachers. For each of them, the user can leave a review. You can not make a separate table for reviews for each entity (courses, teachers, articles), but make one:
That is, course_id and teacher_id = null, then this is a review for the article, if teacher_id and article_id = null, then this is a review for the course and etc.
Answer the question
In order to leave comments, you need to log in
difficult option: only two columns are possible: entity id and entity name. example: model_id, model_type and rows in the table will be for example 1; course, 2; course; 3; article. but in a simple way your solution is quite
Let's say you do this.
Suppose I do not like the article, but I do not want to write a canvas of text, and I will limit myself to the word "garbage". How to understand which element the review will refer to?
For each entity, you need to create a separate table.
One table: feedback (code, object_type, object_code, text).
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question