public function actionCommentvote() { if (!Yii::$app->user->isGuest && Yii::$app->request->post('comment') != null && Yii::$app->request->post('vote') != null) { QueryModel::commentVote(Yii::$app->request->post('comment')); } return CommentRatesActiveRecord::getRates(Yii::$app->request->post('comment')); }
public static function commentVote($id) { $rate = new CommentRatesActiveRecord(); $rate->userId = Yii::$app->user->identity->id; $rate->commentId = $id; $rate->rate = Yii::$app->request->post('vote'); return $rate->save(); }