composer require itedo/itedo-make
ItedoMake\Provider\MakeServiceProvider::class,
根据业务需求,重写常用命令。以方便快捷生成开发文件
命令 |
介绍 |
用法 |
make:auto-controller |
创建资源控制器命令 |
php artisan make:auto-controller Admin |
make:auto-request |
创建请求校验命令 |
php artisan make:auto-request Admin |
make:auto-resource |
创建资源返回命令 |
php artisan make:auto-resource Admin |
clearAll |
清楚所有缓存命令 |
php artisan clearAll |
make:auto-make |
创建资源集合命令 |
php artisan make:auto-make Admin |
*注意:
make:auto-make命令会生成三个文件
├── app
| ├── Http
| ├── Controllers
| ├── AdminControllers.php #命令生成控制器
| ├── Requests
| ├── AdminRequest.php #命令生成请求校验类
| ├── Resources
| ├── AdminResource.php #命令生成资源返回类
整理部分常用命令
命令 |
介绍 |
用法 |
make:migration |
创建数据迁移表 |
php artisan make:migration CreateAdminTable |
migrate |
执行数据表迁移 |
php artisan migrate Admin |
make:model |
创建数据模型 |
php artisan make:model Admin |
make:command |
创建命令定时事务 |
php artisan make:command Admin |
make:event |
创建事件 |
php artisan make:event Admin |
make:job |
创建队列任务 |
php artisan make:job Admin |
make:listener |
创建监听器 |
php artisan make:listener Admin |
make:observer |
创建观察者 |
php artisan make:observer Admin |
make:notification |
创建通知驱动类 |
php artisan make:notification Admin |
make:provider |
创建服务提供者 |
php artisan make:provider Admin |
make:rule |
创建规则类 |
php artisan make:rule Admin |
make:test |
创建单元测试 |
php artisan make:test Admin |