Fastadmin Crud Menu 命令

2019-05-23  本文已影响0人  涳_de26

fastadmin常用命令

//生成fa_test表的CRUD
php think crud -t test
//生成fa_test表的CRUD且一键生成菜单
php think crud -t test -u 1
//删除fa_test表生成的CRUD
php think crud -t test -d 1
//生成fa_test表的CRUD且控制器生成在二级目录下
php think crud -t test -c mydir/test
//生成fa_test_log表的CRUD且生成对应的控制器为testlog
php think crud -t test_log -c testlog
//生成fa_test表的CRUD且对应的模型名为testmodel
php think crud -t test -m testmodel
//生成fa_test表的CRUD且生成关联模型category,外链为category_id,关联表主键为id
php think crud -t test -r category -k category_id -p id
//生成fa_test表的CRUD且所有以list或data结尾的字段都生成复选框
php think crud -t test --setcheckboxsuffix=list --setcheckboxsuffix=data
//生成fa_test表的CRUD且所有以image和img结尾的字段都生成图片上传组件
php think crud -t test --imagefield=image --imagefield=img
//关联多个表,参数传递时请按顺序依次传递,支持以下几个参数relation/relationmodel/relationforeignkey/relationprimarykey/relationfields/relationmode
php think crud -t test --relation=category --relation=admin --relationforeignkey=category_id --relationforeignkey=admin_id
//生成v_phealth_db2数据库下的fa_test表的CRUD
php think crud -t test --db=v_phealth_db2

//一键生成test控制器的权限菜单
php think menu -c test
//一键生成mydir/test控制器的权限菜单
php think menu -c mydir/test
//删除test控制器生成的菜单
php think menu -c test -d 1
//一键全部重新所有控制器的权限菜单
php think menu -c all-controller

本人喜欢用驼峰法命名控制器所以一般操作是 php think crud -t order_goods -c mydir/OrderGoods
然后在菜单中添加菜单规则 mydir/order_goods
在去修改对应public\assets\js\backend\order\goods.js文件中的

index_url: 'mydir/order_goods/index',     //本来是OrderGoods
add_url: 'mydir/order_goods/add',
edit_url: 'mydir/order_goods/edit',
del_url: 'mydir/order_goods/del',
multi_url: 'mydir/order_goods/multi',
上一篇下一篇

猜你喜欢

热点阅读