Answer the question
In order to leave comments, you need to log in
How to properly organize new action notification in Yii2?
Hello. Suppose we have a certain action, for example, an order.
You need to make a notification if a new order has arrived in the site tab (for example: sound, not the point).
As I see it:
1. Add a column to the database unread
, when adding an order, assign it 1.
2. Make action
it, which if there are new orders - returns their number, if not - returns null
.
3. Check new orders with jQuery+AJAX using setInterval()
.
4. If there is a new order - notify. The "Mark as read" button also appears - when it is pressed, all orders with `unread` containing 1 take the value 0.
What are the pitfalls? Perhaps there are better options?
Thanks for answers.
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question