$this->params['breadcrumbs'][] = $this->title; ?> <div class="comment-index"> <h1><?php echo Html::encode($this->title); ?> </h1> <?php // echo $this->render('_search', ['model' => $searchModel]); ?> <p> <?php echo Html::a(Yii::t('app', '创建评论', ['modelClass' => 'Comment']), ['create'], ['class' => 'btn btn-success']); ?> </p> <?php echo GridView::widget(['dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'columns' => [['class' => 'yii\\grid\\SerialColumn'], 'id', 'content:ntext', ['attribute' => 'status', 'label' => '评论状态', 'value' => function ($data) { if (!empty($data->status)) { return '审核通过'; } else { return '等待审核'; } }, 'filter' => [0 => '等待审核', 1 => '审核通过']], 'author_name', ['attribute' => 'post_id', 'label' => '文章ID', 'filter' => yii\helpers\ArrayHelper::map(app\models\Comment::find()->orderBy('id')->asArray()->all(), 'post_id', 'post_id')], ['class' => 'yii\\grid\\ActionColumn']]]); ?> </div>