Gii code generator
This extension provides a web-based code generator called Gii for Yii 2 applications. You can use Gii to quickly generate models, forms, modules, CRUD, and many more.
Getting ready
Create a new application by using composer, as described in the official guide at http://www.yiiframework.com/doc-2.0/guide-start-installation.html.
Create a new migration with the shell command:
php yii migrate/create create_customer_table
Put the following code into the
up()
anddown()
methods:use yii\db\Schema; use yii\db\Migration; class m160201_154207_create_customer_table extends Migration { public function up() { $tableOptions = null; if ($this->db->driverName === 'mysql') { $tableOptions = 'CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE=InnoDB'; } $this->createTable('{{%customer}}', [ 'id' => Schema::TYPE_PK, 'name' => Schema::TYPE_STRING . ' NOT NULL', 'email' =>...