48 lines
1.0 KiB

<?php
namespace api\controllers;
use api\logic\Helper;
use backend\modules\shop\models\ars\Comment;
use Yii;
/**
* @author iron
* @email weiriron@gmail.com
*/
class CommentController extends CommonController
{
public $modelClass = 'backend\modules\shop\models\ars\Comment';
public $className = 'api\logic\CommentLogic';
public function actions()
{
$action = parent::actions();
unset($action['view']);
return $action;
}
/**
* @return object
* @throws yii\base\InvalidConfigException
*/
public function actionIndex()
{
$query = Comment::find()->where(['user_id' => Yii::$app->user->getId()]);
return Helper::index($query);
}
/**
* @return array|Comment|null
* @throws yii\base\Exception
* @throws yii\web\BadRequestHttpException
* @throws yii\web\NotFoundHttpException
* @throws yii\web\ServerErrorHttpException
*/
public function actionCreate()
{
return $this->object->create();
}
}