Answer the question
In order to leave comments, you need to log in
How to organize user notifications in Yii2 through events?
There is such a task. It is necessary to organize a system for notifying users about new materials on the site using Yii2 events.
That is, after adding new material on the site, users should receive a notification about this in the web interface (pop-up window on the site, etc.). Perhaps someone did this on Yii2 or someone has ideas about this.
Thanks in advance.
Answer the question
In order to leave comments, you need to log in
You can implement a notification system approximately as follows:
1. When editing materials on the site, you trigger some event (or use some standard one)
2. Your module subscribes to the necessary events, and when they occur, saves information about the event somewhere (for example, to a database)
3. When the page is updated, the module checks for new events for the user and displays them on the PS page.
Under the module, I mean a group of classes and not the class \yii\base\Module
Check for updates via cron,
plat-x.com/post/nastraivaem-uvedomleniya-administr...
I don’t know how rational this is, but I got out of the situation as follows.
Through the BEFORE_REQUEST event, I check the date of the user's last visit (I store it in cookies and update it every time I visit the site). And if after his last visit there was some kind of record, I notify him.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question