How to make the notification when the status change?

How in one controller to make the change stauts. For example, the administrator appointed to execute the order to the designer, then the designer should be notified that a new order.
In frontend/views/layouts/main.php I have more widget
use yii\bootstrap\Alert;
<?= Alert::widget() ?>

And in the controller, the designer I get
if ($model->status == 3) {
 Yii::$app->session->addFlash('success', 'Received a new order');
 }
June 26th 19 at 14:05
1 answer
June 26th 19 at 14:07
Solution
If You plan to do the notification via a flash message, then it is necessary not only to write but to read. Learn more about working with flash messages you can read here
but there are still some options for alerts? I just met flash
For email, phone I do not need - Waylon_Kub commented on June 26th 19 at 14:10
for example, a Push notification, a notification via sockets, etc. In General, all depends on tasks. - bryana.Renn commented on June 26th 19 at 14:13
: sockets are not yet studied, and later it will go to - Waylon_Kub commented on June 26th 19 at 14:16
As you know in the admin controller I do this
if ($model->load(Yii::$app->request->post())) { 
$model->save();

 if ($model->status == 3) {
 Yii::$app->session->setFlash('disainAdd', 'order Arrived');
}

 return $this->redirect(['view', 'id' => $model->id_zakaz]);
 }

And the designer I enter
$searchModel = new ZakazSearch();
 $dataProvider = $searchModel->search(Yii::$app->request->queryParams, 'disain');

 echo Yii::$app->session->getFlash('disainAdd');

 return $this->render('disain', [
 'searchModel' => $searchModel,
 'dataProvider' => $dataProvider,
 ]);

Or somehow differently it is necessary to implement? - Waylon_Kub commented on June 26th 19 at 14:19
: to transmit a flash message something like this. But if You have Admin and designer are two different user Get the flash message will not work because they are based on cookies, ie just will not work - bryana.Renn commented on June 26th 19 at 14:22
: this is a different users. Then examine the notice with the help of sockets? - Waylon_Kub commented on June 26th 19 at 14:25
: well here, or you can use sockets to send messages, or database: for example to write to the database a notification when the admin changes the status, and when the user refreshes the page - read from the database and display - bryana.Renn commented on June 26th 19 at 14:28
Eating database to do something like that to respond to the notification disappeared. That is not new? - Waylon_Kub commented on June 26th 19 at 14:31
as soon as believed from the database and brought to the user - remove or mark the notification as read - bryana.Renn commented on June 26th 19 at 14:34

Find more questions by tags Yii