/var/www/vhosts/nabawater/common/models
Edit: /var/www/vhosts/nabawater/common/models/Notification.php (1505B)
getUser()->getIdentity();
$modelUser = User::findOne(['user_id' => $userIdentity->getId(),'status' => User::ACTIVE]);
if ($modelUser === null) {
$this->userNotFound();
}
$query = Notification::find()->alias('N')
->select(['N.*'])
->leftJoin(['UN' => UserNotification::tableName()], 'N.notification_id = UN.notification_id')
->Where(['UN.user_id' => $userIdentity->getId()])
->orWhere(['N.is_all_user' => Notification::GLOBAL_NOTIFICATION])
->andWhere(['>','N.notification_id',$modelUser->last_read_notification_id]);
return $query->count();
}
/**
*
* @return array
*/
public function behaviors()
{
$behaviors = parent::behaviors();
$behaviors[] = [
'class' => AttributeKeyGeneratorBehaviour::class,
'attributes' => [
'notification_key'
]
];
return $behaviors;
}
}