Yii2 - Gii generators - how to custom crud templates


1. Create your template folders in your application
yii2 - custom gii crud templates - folder structure








- The name of my template is "ndt"











Yii2 - using kartik Select2 as filter input of GridView



'filter' => Select2::widget([
    'name' => 'CampaignSearch[partner_id]',
    'model' => $searchModel,
    'value' => $searchModel->partner_id,
    'data' => ArrayHelper::map(
        Partner::getAll(), 'id', 'name'
    ),
    'size' => Select2::MEDIUM,
    'options' => [
        'placeholder' => '-- Tất cả --',
        'style' => 'width: 300px;'
    ],
    'pluginOptions' => [
        'allowClear' => true
    ],
    'addon' => [
        'prepend' => [
            'content' => '<i class="glyphicon glyphicon-folder-open"></i>'
        ]
    ],
]),

Yii2 session timeout settings


Edit @yourApp/config/main.php


'components' => [
    'user' => [
        'identityClass' => 'backend\models\User',
        'enableAutoLogin' => true,
        'identityCookie' => [
            'name' => '_cmsIdentity',
            'httpOnly' => true,
            'expire' => 1800,
        ],
        'authTimeout'=> 1800, // seconds
    ],
....
],