Create sample registration form for both legal bodies and individual persons
Files changes:
- common/config/main-local.php - modify db component for selected dbms and created db
- console/migrations/m130524_201442_init.php - create table for ActiveRecords created by form
- common/models/SkyUser.php - ActiveRecord for models created by form
- frontend/assets/RegistrationAsset.php - asset for interactive form's fields hide/show actions
- frontend/controllers/SiteController.php - modify actionIndex (display all SkyUser models), implement actionRegistration (main action for form)
- frontend/models/RegistrationForm.php - form's model for data validation and saving
- frontend/views/site/registration.php - main form's view file
After you install the application, you have to conduct the following steps to initialize the installed application. You only need to do these once for all.
-
Open a console terminal, execute the
init
command and selectdev
as environment./path/to/php-bin/php /path/to/yii-application/init
If you automate it with a script you can execute
init
in non-interactive mode./path/to/php-bin/php /path/to/yii-application/init --env=Development --overwrite=All
-
Create a new database and adjust the
components['db']
configuration in/path/to/yii-application/common/config/main-local.php
accordingly. -
Open a console terminal, apply migrations with command
/path/to/php-bin/php /path/to/yii-application/yii migrate
. -
Set document roots of your web server:
- for frontend
/path/to/yii-application/frontend/web/
and using the URLhttp://frontend.test/
- for backend
/path/to/yii-application/backend/web/
and using the URLhttp://backend.test/
- for frontend
We'll need to use only frontend.test domain: http://frontend.test/index.php?r=site%2Fregistration - url for main actions