index.php 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. <?php
  2. use yii\grid\GridView;
  3. use yii\helpers\Html;
  4. /* @var $this yii\web\View */
  5. /* @var $dataProvider yii\data\ActiveDataProvider */
  6. $this->title = '留言';
  7. $this->params['breadcrumbs'][] = $this->title;
  8. ?>
  9. <div class="suggest-index">
  10. <div class="box box-success">
  11. <div class="box-body">
  12. <?= GridView::widget([
  13. 'dataProvider' => $dataProvider,
  14. 'columns' => [
  15. 'id',
  16. 'title',
  17. [
  18. 'attribute' => 'content',
  19. 'options' => ['width' => '60%']
  20. ],
  21. 'created_at:datetime',
  22. [
  23. 'attribute' => 'user_id',
  24. 'value' => function($model){
  25. return $model->user->username;
  26. }
  27. ],
  28. [
  29. 'class' => 'common\helpers\DiyActionColumn',
  30. 'template' => '{view} {delete}',
  31. ],
  32. ],
  33. ]); ?>
  34. </div>
  35. </div>
  36. </div>