Tuesday, August 11, 2015

yii2 create new module

Yii2 create new project module


1, goto: http://localhost/gii

2. goto: "Module Generator"

3. type something like this: app\modules\contact\Module in the "Module Class" if new module named as "contact"

4. type 'contact' in the Module ID

5. press 'Preview' and 'Generate'

Add DB migrations for the new module 

1. open command line

2. goto project root folder

3. type 
php yii migrate/create --migrationPath=modules/contact/migrations create_contact_table

4. answer 'yes'

Run migration

1. open command line

2. goto project root folder

3. type
php yii migrate/up --migrationPath=modules/contact/migrations

Links:

http://www.elisdn.ru/blog/65/seo-service-on-yii2-moving-users-into-db 

No comments: