public function handle($request, Closure $next)
{
if (session()->has('city') === false) {
session()->put('city', 'Base City');
}
return $next($request);
}
@lang('nav.region'):{{ session('city') }}
short_open_tag = On
short_open_tag = Off
PHP Fatal Error – yii\base\ErrorException
Class 'Html' not found
<?php
defined('YII_DEBUG') or define('YII_DEBUG', true);
defined('YII_ENV') or define('YII_ENV', 'dev');
require(__DIR__ . '/../../vendor/autoload.php');
require(__DIR__ . '/../../vendor/yiisoft/yii2/Yii.php');
require(__DIR__ . '/../../common/config/bootstrap.php');
require(__DIR__ . '/../config/bootstrap.php');
$config = yii\helpers\ArrayHelper::merge(
require(__DIR__ . '/../../common/config/main.php'),
require(__DIR__ . '/../../common/config/main-local.php'),
require(__DIR__ . '/../config/main.php'),
require(__DIR__ . '/../config/main-local.php')
);
$application = new yii\web\Application($config);
$application->run();
<?php
use yii\rbac\DbManager;
return [
'vendorPath' => dirname(dirname(__DIR__)) . '/vendor',
'language' => 'ru-RU',
'components' => [
'cache' => [
'class' => \yii\mongodb\Cache::class,
],
'urlManager' => [
'enablePrettyUrl' => true,
'showScriptName' => false,
],
'userLog' => [
'class' => \common\components\userLog\UserLog::class,
],
'staticManager' => [
'class' => '\common\components\staticManager\LocalStore',
'localPath' => '@frontend/web/file-storage/',
],
'formatter' => [
'class' => \common\components\Formatter::class,
],
'authManager' => [
'class' => DbManager::class,
'itemTable' => 'admin_auth_item',
'itemChildTable' => 'admin_auth_item_child',
'assignmentTable' => 'admin_auth_assignment',
'ruleTable' => 'admin_auth_rule',
],
'authClientCollection' => [
'class' => 'yii\authclient\Collection',
'clients' => [
'facebook' => [
'class' => 'yii\authclient\clients\Facebook',
'clientId' => 'facebook_client_id',
'clientSecret' => 'facebook_client_secret',
],
'google' => [
'class' => 'yii\authclient\clients\Google',
'clientId' => 'google_client_id',
'clientSecret' => 'google_client_secret',
],
],
],
'user' => [
'class' => \common\components\User::class,
],
'currency' => [
'class' => \common\components\Currency::class,
],
'db' => [
'enableSchemaCache' => true,
'queryCacheDuration' => 60,
'class' => 'yii\db\Connection',
'schemaMap' => [
'pgsql' => \common\db\Schema::class, // PostgreSQL
],
'on afterOpen' => function ($event) {
$event->sender->createCommand("SET datestyle = \"German, DMY\"")->execute();
$event->sender->createCommand("SET TIMEZONE TO 'GMT';")->execute();
},
],
'languageDetector' => [
'class' => 'common\components\LanguageDetector',
],
'i18n' => [
'translations' => [
'app' => [
'class' => 'yii\i18n\PhpMessageSource',
'basePath' => '@common/messages',
'sourceLanguage' => 'ru-RU',
// 'fileMap' => [
// 'app' => 'app.php',
// ],
],
],
],
'elasticsearch' => [
'class' => \common\elasticsearch\ElasticsearchConnection::class,
'index' => 'app_name',
'nodes' => [
['http_address' => 'localhost:9200'],
],
],
'mongodb' => [
'class' => '\yii\mongodb\Connection',
'dsn' => 'mongodb://localhost:27017/app_name',
],
],
'aliases' => [
'@bower' => '@vendor/bower-asset',
'@npm' => '@vendor/npm-asset',
],
'bootstrap' => [
'languageDetector', 'log'
],
];
<?php
return [
'components' => [
'db' => [
'class' => 'yii\db\Connection',
'dsn' => 'pgsql:host=localhost;dbname=app_name;port=5432',
'username' => 'postgres',
'password' => '12345',
'charset' => 'utf8',
],
'mailer' => [
'class' => 'yii\swiftmailer\Mailer',
'viewPath' => '@common/mail',
// send all mails to a file by default. You have to set
// 'useFileTransport' to false and configure a transport
// for the mailer to send real emails.
'useFileTransport' => true,
],
'staticManager' => [
'publicDomain' => 'http://app_name.loc',
],
],
];
<?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-frontend',
'basePath' => dirname(__DIR__),
'bootstrap' => ['log'],
'controllerNamespace' => 'frontend\controllers',
'components' => [
'seoModule' => \common\components\SEO\SeoModule::class,
'user' => [
'identityClass' => 'common\models\User',
'enableAutoLogin' => true,
],
'log' => [
'traceLevel' => YII_DEBUG ? 3 : 0,
'targets' => [
[
'class' => 'yii\log\FileTarget',
'levels' => ['error', 'warning'],
],
],
],
'errorHandler' => [
'errorAction' => 'site/error',
],
'urlManager' => [
'rules' => [
'<controller:\w+>/<action:[\w._-]+>' => '<controller>/<action>',
'translation/<lang:\w+>/messages.js' => 'translation/messages',
['class' => '\frontend\urlRules\PageRule', 'pattern' => '<action:\w+>', 'route' => 'page/view'],
],
],
'response' => [
'formatters' => [
\yii\web\Response::FORMAT_JSON => [
'class' => 'yii\web\JsonResponseFormatter',
'prettyPrint' => YII_DEBUG, // use "pretty" output in debug mode
// ...
],
],
],
'assetManager' => [
'forceCopy' => true,
'linkAssets' => false,
'converter' => '\common\components\AssetConverter',
'bundles' => [
'yii\bootstrap\BootstrapAsset'=> false,
// 'yii\bootstrap\BootstrapAsset' => [
// 'basePath' => '@common/assets/resources',
// 'sourcePath' => '@common/assets/resources',
// 'css' => [],
// 'depends' => [
// 'common\assets\CommonStylesAsset'
// ]
// ],
// 'yii\bootstrap\BootstrapPluginAsset' => [
// 'basePath' => '@common/assets/resources',
// 'sourcePath' => '@common/assets/resources',
// 'js' => ['js/bootstrap.min.js']
// ]
],
],
],
'params' => $params,
'modules' => [
'hotel-search' => [
'class' => 'frontend\modules\hotelSearch\Module',
]
]
];
<?php
$config = [
'components' => [
'request' => [
// !!! insert a secret key in the following (if it is empty) - this is required by cookie validation
'cookieValidationKey' => 'XcnyDY1S8ccnOOITjHn-GcIU9f4bRbv4',
],
],
];
if (!YII_ENV_TEST) {
// configuration adjustments for 'dev' environment
$config['bootstrap'][] = 'debug';
$config['modules']['debug'] =[
'class' => 'yii\debug\Module',
'panels' => [
\yii\mongodb\debug\MongoDbPanel::class,
],
'allowedIPs' => ['127.0.0.1', '::1', '192.168.*'],
];
$config['bootstrap'][] = 'gii';
$config['modules']['gii'] = [
'class' => 'yii\gii\Module',
'generators' => [
'crud' => ['class' => 'common\gii\crud\Generator'],
],
'allowedIPs' => ['127.0.0.1', '::1', '192.168.*'],
];
}
return $config;
Сделал как вы советуете,
Пробывал еще так:
Но в браузере ничего не отображается, т.е. массив profile empty приходит пустой, смотрел через Vue DevTools
UPD: Хотя даже просто вот так, ничего не отдает:
Проблема где-то глубже, буду копать