Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How do config GII for create models #3

Closed
matheuscamarques opened this issue Dec 4, 2020 · 1 comment
Closed

How do config GII for create models #3

matheuscamarques opened this issue Dec 4, 2020 · 1 comment

Comments

@matheuscamarques
Copy link

How do config GII for create models?

@hoaaah
Copy link
Owner

hoaaah commented Dec 8, 2020

Modified your config.php and add gii to bootstrap and modules.

<?php

return [
    'id' => 'micro-app',
    // the basePath of the application will be the `micro-app` directory
    'basePath' => dirname(__DIR__),
    'bootstrap' => ['gii'],
    'modules' => [
        'v1' => [
            'class' => 'app\modules\v1\v1',
        ],
        'gii' => [
            'class' => 'yii\gii\Module',
        ],
    ],
    // this is where the application will find all controllers
    'controllerNamespace' => 'app\controllers',
    // set an alias to enable autoloading of classes from the 'micro' namespace
    'aliases' => [
        '@app' => __DIR__.'/../',
    ],
    'components' => [
        'urlManager' => [
            'class' => 'yii\web\UrlManager',
            'enablePrettyUrl' => true,
            'showScriptName' => false,
            'rules' => [
                '<alias:\w+>' => 'site/<alias>',            
            ],
        ],
        'user' => [
            'identityClass' => 'app\models\UserIdentity',
            'enableAutoLogin' => false,
            'enableSession' => false,
            'loginUrl' => null,
        ],
        'request' => [
            'parsers' => [
                'application/json' => 'yii\web\JsonParser',
            ],
            'enableCsrfCookie' => false,
        ],
        'db' => $db,
    ],
    'params' => $params,
];

I haven't try it, but it should work. And don't forget to include "yiisoft/yii2-gii" to your composer.json.

@hoaaah hoaaah closed this as completed Dec 10, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants