main.php 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. <?php
  2. $params = array_merge(
  3. require __DIR__ . '/../../common/config/params.php',
  4. require __DIR__ . '/params.php'
  5. );
  6. return [
  7. 'id' => 'app-backend',
  8. 'basePath' => dirname(__DIR__),
  9. 'controllerNamespace' => 'backend\controllers',
  10. 'bootstrap' => ['log'],
  11. 'modules' => [],
  12. 'components' => [
  13. 'request' => [
  14. 'csrfParam' => '_csrf-backend',
  15. ],
  16. 'user' => [
  17. 'identityClass' => 'common\models\User',
  18. 'enableAutoLogin' => true,
  19. 'identityCookie' => ['name' => '_identity-backend', 'httpOnly' => true],
  20. ],
  21. 'session' => [
  22. // this is the name of the session cookie used for login on the backend
  23. 'name' => 'advanced-backend',
  24. ],
  25. 'log' => [
  26. 'traceLevel' => YII_DEBUG ? 3 : 0,
  27. 'targets' => [
  28. [
  29. 'class' => 'yii\log\FileTarget',
  30. 'levels' => ['error', 'warning'],
  31. ],
  32. ],
  33. ],
  34. 'errorHandler' => [
  35. 'errorAction' => 'site/error',
  36. ],
  37. 'urlManager' => [
  38. 'enablePrettyUrl' => true,
  39. 'showScriptName' => false,
  40. 'rules' => [
  41. 'login'=>'site/login',
  42. 'logout'=>'site/logout',
  43. "<controller:\w+>/<action:\w+>/<id:\d+>"=>"<controller>/<action>",
  44. "<controller:\w+>/<action:\w+>"=>"<controller>/<action>"
  45. ],
  46. ],
  47. ],
  48. 'params' => $params,
  49. ];