index.php 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. <?php
  2. use yii\helpers\Html;
  3. use yii\grid\GridView;
  4. /* @var $this yii\web\View */
  5. /* @var $searchModel backend\models\search\AddressSearch */
  6. /* @var $dataProvider yii\data\ActiveDataProvider */
  7. $this->title = Yii::t('common', 'Addresses');
  8. $this->params['breadcrumbs'][] = $this->title;
  9. ?>
  10. <?php $this->beginBlock('content-header') ?>
  11. <?= $this->title ?>
  12. <?php $this->endBlock() ?>
  13. <?php // echo $this->render('_search', ['model' => $searchModel]); ?>
  14. <div class="box box-success">
  15. <div class="box-body">
  16. <?= GridView::widget([
  17. 'dataProvider' => $dataProvider,
  18. 'filterModel' => $searchModel,
  19. 'columns' => [
  20. // 'id',
  21. 'user_id:user',
  22. 'name',
  23. 'tel',
  24. [
  25. 'label' => '地址',
  26. 'value' => function ($model) {
  27. /* @var $model \common\models\Address */
  28. return $model->getFullAddress();
  29. }
  30. ],
  31. [
  32. 'attribute' => 'is_default',
  33. 'value' => function ($model) {
  34. /* @var $model \common\models\Address */
  35. return $model->is_default ? '是' : '否';
  36. }
  37. ],
  38. // 'city',
  39. // 'area',
  40. // 'detail',
  41. // 'created_at',
  42. // 'updated_at',
  43. // 'status',
  44. ],
  45. ]); ?>
  46. </div>
  47. </div>