Exemplo n.º 1
0
 /**
  * @param $recordId
  * @return bool
  */
 private function _checkVote($recordId)
 {
     $where = ['record_id' => $recordId];
     if (\Yii::$app->user->isGuest) {
         $where['user_hash'] = Utils::userHash(\Yii::$app->request->userIP);
     } else {
         $where['user_id'] = \Yii::$app->user->id;
     }
     if (Rating::find()->where($where)->count()) {
         return true;
     }
     return false;
 }
Exemplo n.º 2
0
 /**
  * @inheritdoc
  */
 public function attributeLabels()
 {
     return ['id' => Rating::t('common', 'ID'), 'record_id' => Rating::t('common', 'Record ID'), 'user_id' => Rating::t('common', 'User ID'), 'user_hash' => Rating::t('common', 'User Hash'), 'rating' => Rating::t('common', 'Rating'), 'created_at' => Rating::t('common', 'Created At')];
 }