protected function createItem()
 {
     $nQuery = (new Query())->from(Notification::tableName())->where(['user_id' => Yii::$app->user->id]);
     $nCount = $nQuery->count();
     $notifications = $nQuery->select(['path_info', 'text', 'n' => 'COUNT(*)'])->groupBy(['path_info'])->all();
     $label = Html::tag('i', '', ['class' => $this->icon]);
     $item['label'] =& $label;
     if ($nCount > 0) {
         $label .= Html::tag('span', $nCount, ['class' => 'badge']);
         $items = [];
         foreach ($notifications as $notification) {
             $items[] = ['label' => Yii::t('notifications', $notification['text'], ['count' => $notification['n']]), 'url' => $notification['path_info']];
         }
         $item['items'] = $items;
     }
     return $item;
 }
 protected function checkNotification()
 {
     Notification::deleteAll(['user_id' => Yii::$app->user->id, 'path_info' => '/' . Yii::$app->request->getPathInfo()]);
 }