'modules' => [
'user' => [
'class' => 'dektrium\user\Module',
'mailer' => [
'sender' => 'service@******', // or ['no-reply@myhost.com' => 'Sender name']
'welcomeSubject' => 'Добро пожаловать.',
'confirmationSubject' => 'Подтверждение',
'reconfirmationSubject' => 'Изменение email',
'recoverySubject' => 'Сброс пароля.',
],
'admins' => ['avkotosin', '*****'],
'enableGeneratingPassword' => true, // Автоматическая генерация пароля
'modelMap' => [
'Account' => 'app\models\Account',
'Contact' => 'app\modules\dashboard\models\Contact',
'ContactForm' => 'app\models\ContactForm',
'LoginForm' => 'app\models\LoginForm',
'Profile' => 'app\models\Profile',
'RecoveryForm' => 'app\models\RecoveryForm',
'RegistrationForm' => 'app\models\RegistrationForm',
'ResendForm' => 'app\models\ResendForm',
'Setting' => 'app\models\Setting',
'SettingForm' => 'app\models\SettingForm',
'Token' => 'app\models\Token',
'User' => 'app\models\User',
'UserSearch' => 'app\models\UserSearch'
],
'controllerMap' => [
'admin' => 'app\controllers\user\AdminController',
'profile' => 'app\controllers\user\ProfileController',
'recovery' => 'app\controllers\user\RecoveryController',
'registration' => [
'class' => 'app\controllers\user\RegistrationController',
'layout' => '@app/views/layouts/security',
],
'security' => [
'class' => 'app\controllers\user\SecurityController',
'layout' => '@app/views/layouts/security',
],
'setting' => 'app\controllers\user\SettingController'
],
],
'dashboard' => [
'class' => 'app\modules\dashboard\Mudule',
'layout' => 'main',
'defaultRoute' => 'dashboard/index',
],
],
use dektrium\user\models\User as BaseUser;
<?php
namespace app\modules\dashboard\models;
use dektrium\user\models\User as BaseUser;
use app\modules\dashboard\models\Contact;
class User extends BaseUser
{
/**
* @return \yii\db\ActiveQuery
*/
public function getСontact()
{
return $this->hasOne(Contact::className(), ['user_id' => 'id']);
}
}
<?php
namespace app\modules\dashboard\controllers;
use yii\web\Controller;
use Yii;
use app\modules\dashboard\models\User;
/**
* Default controller for the `dashboard` module
*/
class DefaultController extends Controller
{
public $layout = 'main';
/**
* Renders the index view for the module
* @return string
*/
public function actionIndex() {
return $this->render('index');
}
public function actionProfile() {
$id = Yii::$app->user->id;
$user = User::findOne($id);
return $this->render('profile', compact('user'));
}
}
Getting unknown property: app\modules\dashboard\models\User::contact
Yii::$app->user->contact
Unknown Property – yii\base\UnknownPropertyException
Getting unknown property: yii\web\User::contact
namespace app\controllers\user;
....
use dektrium\user\models\User
....
'identityClass' => 'dektrium\user\models\User',
echo "ok";
RewriteCond %{DOCUMENT_ROOT}/folder/$1 -f
RewriteRule ^(.*)$ folder/$1 [L,QSA]