Answer the question
In order to leave comments, you need to log in
How to make a beautiful solution in Yii2?
Hello, there is a task of a certain notification module that will notify about various events on the site, the event can be a callback, or they left a review or wrote a message in the contact form, the problem is that I can’t display all this on the screen, I need to display it given the date, as a result, I created a table:
timeline
id, entity_name, entity_id, created_at
entity_name - stores the name of the entity, in this example it can be either Callback or Reviews or messages
entity_id - respectively the id of a specific record
Advise me how to make a request and get all this connection
Answer the question
In order to leave comments, you need to log in
SELECT *
FROM `timeline`
WHERE `created_at` BETWEEN "2014-07-17 00:00:00" AND "2014-07-17 23:59:59"
Forgive me in advance if I'm talking nonsense. Create a table:
id, event, value, date
Fill in:
1 contact form 0 00-00-000
2 callback 0 00-00-000
3 other event 0 00-00-000
As soon as the contact form arrives, change the value 0 to 1, set the date.
Request: select where "value" != 0 we get:
You have 2 pending requests from the form, 1 call and 3 other events.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question