web.php 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. <?php
  2. $params = require __DIR__ . '/params.php';
  3. $db = require __DIR__ . '/db.php';
  4. $routes = require __DIR__ . '/routes.php';
  5. $config = [
  6. 'id' => 'basic',
  7. 'basePath' => dirname(__DIR__),
  8. 'bootstrap' => ['log'],
  9. 'language' => 'ru_RU',
  10. 'aliases' => [
  11. '@bower' => '@vendor/bower-asset',
  12. '@npm' => '@vendor/npm-asset',
  13. '@manager'=>'@app/modules/manager'
  14. ],
  15. 'components' => [
  16. 'request' => [
  17. // !!! insert a secret key in the following (if it is empty) - this is required by cookie validation
  18. 'cookieValidationKey' => 'WyEyjj5Lk_8A5msMn1mn5-UQN_xDaNsc',
  19. ],
  20. 'cache' => [
  21. 'class' => 'yii\caching\FileCache',
  22. ],
  23. 'user' => [
  24. 'identityClass' => 'app\models\User',
  25. 'enableAutoLogin' => true,
  26. ],
  27. 'errorHandler' => [
  28. 'errorAction' => 'site/error',
  29. ],
  30. 'mailer' => [
  31. 'class' => 'yii\swiftmailer\Mailer',
  32. // send all mails to a file by default. You have to set
  33. // 'useFileTransport' to false and configure transport
  34. // for the mailer to send real emails.
  35. 'useFileTransport' => true,
  36. ],
  37. 'log' => [
  38. 'traceLevel' => YII_DEBUG ? 3 : 0,
  39. 'targets' => [
  40. [
  41. 'class' => 'yii\log\FileTarget',
  42. 'levels' => ['error', 'warning'],
  43. ],
  44. ],
  45. ],
  46. 'db' => $db,
  47. 'old_db' => require __DIR__ . '/db_old.php',
  48. 'urlManager' => [
  49. 'enablePrettyUrl' => true,
  50. 'showScriptName' => false,
  51. 'rules' =>$routes,
  52. ],
  53. ],
  54. "modules"=>[
  55. "manager"=>[
  56. "class"=>manager\Manager::class
  57. ],
  58. 'user' => [
  59. 'class' => 'dektrium\user\Module',
  60. 'admins' => ['admin'],
  61. 'adminPermission' => 'admin',
  62. 'controllerMap' => [
  63. 'admin' => [
  64. 'class' => 'dektrium\user\controllers\AdminController',
  65. 'layout' => '@manager/views/layouts/main'
  66. ],
  67. 'profile' => [
  68. 'class' => 'dektrium\user\controllers\ProfileController',
  69. 'layout' => '@manager/views/layouts/main'
  70. ],
  71. ]
  72. ],
  73. 'rbac' => [
  74. 'class' => 'dektrium\rbac\RbacWebModule',
  75. 'controllerMap' => [
  76. 'role' => [
  77. 'class' => 'dektrium\rbac\controllers\RoleController',
  78. 'layout' => '@manager/views/layouts/main'
  79. ],
  80. 'permission' => [
  81. 'class' => 'dektrium\rbac\controllers\PermissionController',
  82. 'layout' => '@manager/views/layouts/main'
  83. ],
  84. 'rule' => [
  85. 'class' => 'dektrium\rbac\controllers\RuleController',
  86. 'layout' => '@manager/views/layouts/main'
  87. ]
  88. ]
  89. ]
  90. ],
  91. 'params' => $params,
  92. ];
  93. if (YII_ENV_DEV) {
  94. // configuration adjustments for 'dev' environment
  95. $config['bootstrap'][] = 'debug';
  96. $config['modules']['debug'] = [
  97. 'class' => 'yii\debug\Module',
  98. // uncomment the following to add your IP if you are not connecting from localhost.
  99. //'allowedIPs' => ['127.0.0.1', '::1'],
  100. ];
  101. $config['bootstrap'][] = 'gii';
  102. $config['modules']['gii'] = [
  103. 'class' => 'yii\gii\Module',
  104. // uncomment the following to add your IP if you are not connecting from localhost.
  105. 'allowedIPs' => ['*'],
  106. ];
  107. }
  108. Yii::setAlias('@manager', '../modules/manager');
  109. return $config;