Answer the question
In order to leave comments, you need to log in
How to make a reminder?
I want to implement a reminder on a website. But to make it so that it was recorded in the notification table. I just don’t understand how to make sure that the reminder is saved and entered as a notification.
Reminders are saved if the expiration date is then saved as a notification that the order is overdue.
I tried using action, but it didn’t work and where should I write the code
public function actionReminder($id)
{
$model = $this->findModel($id)
$reminder = new Notification();
if ($model->srok<date('Y-m-d')) {
$reminder->id_user = 1;
$reminder->name = 'Срок пропущен в №'.$model->id_zakaz;
$reminder->id_zakaz = $model->id_zakaz;
$reminder->category = 4;
$reminder->active = true;
$reminder->save();
}
}
Answer the question
In order to leave comments, you need to log in
There is a user, an order is associated with him, select all user orders whose creation date is between the current date and the old date (for example, the current date minus the month)
If there are any, display a message. In order not to load the database especially, you can simply count() and display the message "You have n orders not paid" with a link to the page with all orders. I would also cache this request for a day and pull this figure from the cache. If zero - do not show the message. When you click on the link to orders, we write zero to the cache. so that they don't show up anymore.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question