public function actionaddcomment($postId, $comment) { $model = new CommentBussinessPage(); $model->user_id = Yii::app()->user->userId; $model->post_id = $postId; $model->date = date('Y-m-d H:i:s'); $model->comment = $comment; $model->save(); }
public function actionaddcomment($postId, $comment, $text) { if ($text == 'post') { $model = new CommentPost(); $model->user_id = Yii::app()->user->userId; $model->post_id = $postId; $model->date = date('Y-m-d H:i:s'); $model->comment = $comment; $model->save(); } else { if ($text == 'page') { $model = new CommentBussinessPage(); $model->user_id = Yii::app()->user->userId; $model->post_id = $postId; $model->date = date('Y-m-d H:i:s'); $model->comment = $comment; $model->save(); } } }