<?php
$params = array_merge(
    require(__DIR__ . '/../../common/config/params.php'),
    require(__DIR__ . '/../../common/config/params-local.php'),
    require(__DIR__ . '/params.php'),
    require(__DIR__ . '/params-local.php')
);

return [
    'id' => 'app-backend',
    'basePath' => dirname(__DIR__),
    'controllerNamespace' => 'backend\controllers',
    'language' => 'zh-CN',
    'bootstrap' => ['log'],
    'modules' => [
        'admin' => [
            'class' => 'backend\modules\admin\Module',
        ],
    ],
    'components' => [
        'request' => [
            'csrfParam' => '_csrf-backend',
        ],
        'user' => [
            'class' => 'yii\web\User',
            'identityClass' => 'backend\models\MemberIdentity',
            'identityCookie' => ['name' => '_identity-backend-admin', 'httpOnly' => true],
            'loginUrl' => ['account/adminlogin'],
            'idParam' => '__id_admin',
            'authTimeoutParam' => '__expire_admin',
            'absoluteAuthTimeoutParam' => '__absoluteExpire_admin',
            'returnUrlParam' => '__returnUrl_admin',
            'as loginCookie' => [
                'class' => 'common\behaviors\LoginCookieBehavior',
            ],
        ],
        'session' => [
            // this is the name of the session cookie used for login on the backend
            'name' => 'advanced-backend',
        ],
        'log' => [
            'traceLevel' => YII_DEBUG ? 3 : 0,
            'targets' => [
                [
                    'class' => 'yii\log\FileTarget',
                    'levels' => ['error', 'warning'],
                ],
            ],
        ],
        'errorHandler' => [
            'errorAction' => 'site/error',
        ],
        'urlManager' => [
            'enablePrettyUrl' => true,
            'showScriptName' => false,
            'rules' => [
                'adminL0gin3721' => 'account/adminlogin',
            ],
        ],
        'assetManager' => [
            'bundles' => [
                'yii\web\JqueryAsset' => [
                    'sourcePath' => null,
                    'basePath' => '@webroot',
                    'baseUrl' => '@web',
                    'js' => [
                        'ui/js/jquery.1.9.1.min.js',
                    ],
                ],
            ],
        ],
    ],
    'params' => $params,
];
