Answer the question
In order to leave comments, you need to log in
How to send a notification using session->setFlash to another user?
I use alert from v-kartik. Everything works, but ...
It is necessary that when sending a message, a notification is received not by the sender, but by the recipient.
in controller:
Yii::$app->getSession(тут должен быть ид юзера?)->setFlash('message, [
]);
return $this->redirect(['view', 'id' => $model->id]);
} else {
return $this->render('create', [
'model' => $model,
]);
}
<?php foreach (Yii::$app->session->getFlash(ид юзера) as $message):; ?>
<?php
echo Growl::widget([
'type' => Growl::TYPE_GROWL,
'title' => 'Roar!',
'icon' => '/images/icon.png',
'body' => 'This is a default growling alert you requested for.',
'showSeparator' => false,
'delay' => 6000,
'pluginOptions' => [
'icon_type'=>'image',
'placement' => [
'from' => 'top',
'align' => 'right',
],
'template' => [
'icon_type' => 'image'
]
]
]);
?>
<?php endforeach; ?>
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