CURD Commands

The EasyAdmin8 framework includes built-in commands for quickly generating CURD, including controllers, views, models, and JS files. This further improves developer efficiency.

Common Commands

# Generate CURD for the ea8_test_goods table
php think curd -t test_goods

# Generate CURD for ea8_test_goods, force overwrite on file conflict
php think curd -t test_goods -f 1

# Delete CURD for ea8_test_goods
php think curd -t test_goods -d 1

# Generate CURD for ea8_test_goods, controller at demo/Goods.php
php think curd -t test_goods -c demo/Goods

# Generate CURD for ea8_test_goods, model at demo/Goods.php
php think curd -t test_goods -m demo/Goods

# Generate CURD for ea8_test_goods, related to ea8_test_cate table, with foreign key cate_id
php think curd -t test_goods -r test_cate --foreignKey=cate_id --primaryKey=id

# Generate CURD for ea8_test_goods, related to ea8_test_cate table, only show title and image fields
php think curd -t test_goods -r test_cate --foreignKey=cate_id --relationOnlyFields=title,image

# Generate CURD for ea8_test_goods, related to ea8_test_cate table, set the main table foreign key cate_id dropdown to show the related table's title field
php think curd -t test_goods -r test_cate --foreignKey=cate_id --relationBindSelect=title

# Generate CURD for ea8_test_goods, set logo field suffix as single image
php think curd -t test_goods --imageFieldSuffix=logo

# Generate CURD for ea8_test_goods, ignore remark and stock fields
php think curd -t test_goods --ignoreFields=remark --ignoreFields=stock

Parameter Reference

ShortLongDescription
-t--table=VALUEMain table name
-c--controllerFilename=VALUEController filename
-m--modelFilename=VALUEMain table model filename
-f--force=VALUEForce overwrite mode
-d--delete=VALUEDelete mode
--checkboxFieldSuffix=VALUECheckbox field suffix
--radioFieldSuffix=VALUERadio button field suffix
--imageFieldSuffix=VALUESingle image field suffix
--imagesFieldSuffix=VALUEMultiple images field suffix
--fileFieldSuffix=VALUESingle file field suffix
--filesFieldSuffix=VALUEMultiple files field suffix
--dateFieldSuffix=VALUEDate field suffix
--switchFields=VALUESwitch/toggle fields
--selectFields=VALUEDropdown select fields
--editorFields=VALUERich text editor fields
--sortFields=VALUESort fields
--ignoreFields=VALUEFields to ignore
-r--relationTable=VALUERelated table name
--foreignKey=VALUEForeign key
--primaryKey=VALUEPrimary key
--relationOnlyFields=VALUEFields to display only from related model
--relationBindSelect=VALUERelated model field for main table foreign key dropdown
--relationModelFilename=VALUERelated model filename