Yii2DbRbac.php
897 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
<?php
/**
* Yii2DbRbac for Yii2
*
* @author Elle <elleuz@gmail.com>
* @version 0.1
* @package Yii2DbRbac for Yii2
*
*/
namespace common\components\developeruz\db_rbac;
use Yii;
class Yii2DbRbac extends \yii\base\Module
{
public $controllerNamespace = 'common\components\developeruz\db_rbac\controllers';
public $userClass;
public function init()
{
parent::init();
$this->registerTranslations();
}
public function registerTranslations()
{
Yii::$app->i18n->translations['db_rbac'] = [
'class' => 'yii\i18n\PhpMessageSource',
'sourceLanguage' => 'ru-Ru',
'basePath' => '@developeruz/db_rbac/messages',
];
}
public static function t($category, $message, $params = [], $language = null)
{
return Yii::t('modules/db_rbac/' . $category, $message, $params, $language);
}
}