Module::behaviors()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 14

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 14
rs 9.7998
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
3
namespace app\modules\admin;
4
5
use yii2mod\rbac\filters\AccessControl;
6
7
/**
8
 * Class Module
9
 *
10
 * @package app\modules\admin
11
 */
12
class Module extends \yii\base\Module
13
{
14
    /**
15
     * @var string the default route of this module. Defaults to 'default'
16
     */
17
    public $defaultRoute = 'user';
18
19
    /**
20
     * @var string|bool the layout that should be applied for views within this module
21
     */
22
    public $layout = 'column2';
23
24
    /**
25
     * @var string the namespace that controller classes are in
26
     */
27
    public $controllerNamespace = 'app\modules\admin\controllers';
28
29
    /**
30
     * @inheritdoc
31
     */
32
    public function behaviors(): array
33
    {
34
        return [
35
            'access' => [
36
                'class' => AccessControl::class,
37
                'rules' => [
38
                    [
39
                        'allow' => true,
40
                        'roles' => ['admin'],
41
                    ],
42
                ],
43
            ],
44
        ];
45
    }
46
}
47