M
M
Maxim Grechushnikov2014-12-27 04:04:05
Yii
Maxim Grechushnikov, 2014-12-27 04:04:05

Yii2 Self Routing. How to write paths correctly?

How to write paths correctly? Something I hung ...
There is an "admin panel" module as a vendor.

'admin' => [
        'class' => '*****\******\modules\admin\Module'
    ],

Works ok.
You need to extend UrlManager to handle your admin paths.
...
class UrlManager extends \yii\web\UrlManager{
    public function init(){
        $this->rules = [
            'admin/dashboard'=>'admin/index' // <-- как правильно здесь нужно указать путь к контроллеру находящегося в вендоре что и админка?
        ];
        return parent::init();
    }
}

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexander Zelenin, 2014-12-27
@zelenin

the path to the controller located in the vendor as the admin panel

what do you mean by vendor?
specify the path like this:
moduleId - array key in the config where you added the module. In your case admin

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question