Skip to content

Instantly share code, notes, and snippets.

// My code
<?php
$collection=\app\models\Notifications::getCollection()->name;
if ($this->beginCache('Notifghjgjhgication', ['dependency' => [
'class' => 'yii\caching\DbQueryDependency',
'method' =>function(){ return \app\models\Notifications::find()->where(["receiver_type" => "vendor", "receiver_id" => \Yii::$app->user->identity->_id, 'read_status' => FALSE])->count();},
]])) {?>
<li class="dropdown" id="Notification-list-container">
<?= Yii::$app->runAction('/notification/default/notificationlist') ?>
</li>