adele332 / crudgenerator
Laravel 框架的 CRUD 生成器
1.0.0
2023-01-22 15:38 UTC
Requires
This package is auto-updated.
Last update: 2024-09-22 20:58:32 UTC
README
这个 Laravel 包将为您提供使用命令行快速创建 CRUD 功能的机会。您将能够从命令行
- 创建模型
- 创建迁移
- 创建控制器
- 为特定表格创建视图
- 创建主网站视图(登录、注册和 CRUD 功能)
要求
此包需要
- Laravel >= 9.33.0
- PHP >= 8.0.2
- Composer >= 2.4.2
安装
- 运行命令
composer require adele332/crudgenerator
- 运行命令
php artisan list
- 检查您是否在列表中看到新添加的命令
If you see new commands that means that you successfuly installed this package! :)
项目中新添加的命令
将会有 5 个新命令,您将在运行命令 'php artisan list' 后看到
- php artisan make:model
- php artisan make:controllers
- php artisan make:migrations
- php artisan make:view
- php artisan make:main
适合的命令示例
- 创建模型的命令
php artisan make:model Genre --table="genres" --fields="['id','title','created_at','updated_at']"
- 创建控制器的命令
php artisan make:controllers Genres --model="Genre" --fields-validation="'title' => 'required|alpha|min:2'" --dir-to-save-file=admin
- 创建迁移的命令
php artisan make:migrations Genres --table-schema="title:string"
- 创建视图的命令(您只能在数据库中有数据表时使用此命令)
php artisan make:model Genre --table="genres" --fields="['id','title','created_at','updated_at']"
- 创建主视图的命令(此命令必须只使用一次)
php artisan make:main MyCrudGenerator