L
L
lzy2018-12-15 18:34:15
Yii
lzy, 2018-12-15 18:34:15

How to find out about a new entry in the database?

Such a question, for example, now 10 products are stored in the database, but one of the users added 1 product, when entering the admin panel, how to notify the admin that a product has been added? What is the logic of this function, are there examples of implementation in the internet?

Answer the question

In order to leave comments, you need to log in

3 answer(s)
M
morricone85, 2018-12-15
@lzy

I did something like this (only, instead of goods there were messages):
1) the -status- field, where 1 is a new message, 0 is viewed by the admin;
2) to display new ones - there is a request + where status = 1;
3) when viewed by the admin in the admin panel, you need to update the status: Update....
status = 0 where id =...

S
Sergey Krivosheev, 2018-12-15
@Nemozar

Make a notification system. When adding a new product in the afterSave method in the model, write information to the table with notifications.
And when you log in as an administrator, show all unread notifications. Well, a separate form for displaying all notifications.

G
glebvvs, 2018-12-15
@glebvvs

You can try after adding the product by someone to the session or database, write down, they say, the product was added and data about it. And when there is an entrance to the admin panel, check whether there is a given session or an entry in the database.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question