1、控制器处理

PHP artisan make:controller 控制器名称或者/文件路径+控制器名称  例如:php artisan make:controller /Admin/SysRoleController

 

 

创建Rest风格资源控制器(带有index、create、store、edit、update、destroy、show方法)

php artisan make:controller SysRoleController--resource

2、模型处理

PHP artisan make:mode  模型名或者/文件路径+模型名称  例如:php artisan make:model /Admin/SysRole

3、同时生成C,M,R,即同时生成控制器、模型、路由

php artisan make:model SysRoleController-m -c -r

 

4、关于对数据迁移的处理

创建新建表的迁移(需要注意的是Laravel访问model时默认表名是模型名称规则的复数,除了指定表名的之外,所以命名记得复数

php artisan make:migration create_sys_user_table //创建sys_user 表

修改表的迁移

php artisan make:migration alter_sys_role_table  //创建 sys_role 数据表的修改迁移文件

执行迁移

php artisan migrate

回滚上一次的迁移

php artisan migrate:rollback

 

 

回滚所有迁移

php artisan migrate:reset