yii2-netdisk/views/country/index.php
2024-02-09 12:15:09 +08:00

46 lines
1.1 KiB
PHP

<?php
use app\models\Country;
use yii\helpers\Html;
use yii\helpers\Url;
use yii\grid\ActionColumn;
use yii\grid\GridView;
/** @var yii\web\View $this */
/** @var app\models\CountrySearch $searchModel */
/** @var yii\data\ActiveDataProvider $dataProvider */
$this->title = 'Countries';
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="country-index">
<h1><?= Html::encode($this->title) ?></h1>
<p>
<?= Html::a('Create Country', ['create'], ['class' => 'btn btn-success']) ?>
</p>
<?php // echo $this->render('_search', ['model' => $searchModel]); ?>
<?= GridView::widget([
'dataProvider' => $dataProvider,
'filterModel' => $searchModel,
'columns' => [
['class' => 'yii\grid\SerialColumn'],
'code',
'name',
'population',
[
'class' => ActionColumn::className(),
'urlCreator' => function ($action, Country $model, $key, $index, $column) {
return Url::toRoute([$action, 'code' => $model->code]);
}
],
],
]); ?>
</div>