Documentation
Craft Console
Introduction
Craft console built on top of popular Symfony console component. It provides you helpful commands to make your development faster.
Code Generation
Code Generation - Crud Generation
php craft generate:crud controller table_name database //plain php layout, views
php craft generate:crud controller table_name database --template// twig templates
or
php craft generate:crud controller table_name // Default database connection
php craft generate:crud controller table_name --template // twig templates for view page
Database Migration and Seeding
Database Migration
php craft migrate:init table_name
php craft migrate up
php craft migrate down
Form Generator
php craft form:create table_name database
or
php craft form:create table_name // Default database connection
Generating Basic Controller
Below command will generate basic ProductController into your controllers folder.
php craft controller:create product
Generating Resource Controller
Below command will generate resource ProductController into your controllers folder.
php craft controller:create product --resource
Generating Models
Below command will generate model class called ProductCategory into your models directory.
php craft model:create product_category directory
Above command "product_category" represent table name and "directory" represent as database.
If you want to generate model against your default database connection then we can also make above shorter.
php craft model:create product_category
Above features are driven by Cygnite CLI tool to make your job very easy.