Showing posts with label Yii2. Show all posts
Showing posts with label Yii2. Show all posts

yii2 session timeout not working

set property authTimeout in user component

and set propety enableAutoLogin to false
'user' => [
        'identityClass'   => 'common\models\User',
        'enableAutoLogin' => false,
        'authTimeout'     => 20
],

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
    ],
....
],