yii2-user icon indicating copy to clipboard operation
yii2-user copied to clipboard

Custom Controller

Open orlandovillarreal opened this issue 9 years ago • 1 comments

Hello,

I'm using your yii2 extension on a project I'm doing, but I have a doubt: How can I extend to create my own controller? I have already read the documentation (https://github.com/amnah/yii2-user#how-do-i-extend-this-package) but I had problems in understanding the example you gave. Please keep in mind I'm fairly new to programming, so I would greatly appreciate it if you could be as detailed as possible when giving the explanation.

Thanks a lot and keep up the great work!

orlandovillarreal avatar Nov 08 '16 06:11 orlandovillarreal

The important part in that code is this:

        'controllerMap' => [
            'default' => 'app\controllers\MyDefaultController',
        ],

So you basically need to create a file like app\controllers\MyDefaultController.php and point the module to it. And that file would look like this:

<?php
namespace app\controllers;
use Yii;
class MyDefaultController extends \amnah\yii2\user\controllers\DefaultController
{
}

(Feel free to rename the controller)

amnah avatar Nov 08 '16 13:11 amnah