mdarmancse/autolara
最新稳定版本:v3.0.2
Composer 安装命令:
composer require mdarmancse/autolara
包简介
Auto CRUD generation with Repository Pattern
README 文档
README
AutoLara is a Laravel package that automatically generates CRUD operations, including models, migrations, controllers, repositories, and routes based on a simple Artisan command.
Features
- 🔹 Generates Model, Migration, Controller, Repository, and Form Requests.
- 🔹 Updates Routes automatically.
- 🔹 Runs migration after generation.
- 🔹 Uses stub templates for customization.
Installation
Run the following command to install AutoLara:
composer require mdarmancse/autolara
Usage
Run the following command to generate CRUD for a model with specified fields:
php artisan autolara:crud ModelName field1:type field2:type ...
Example:
php artisan autolara:crud Product name:string price:integer is_active:boolean
Expected Output:
🔄 Generating CRUD for: Product
✅ Model created: Product
✅ Migration created: products
✅ Repository for Product generated.
✅ Controller created: ProductController
✅ Form request for Product generated.
✅ Routes for Product updated.
⚡ Running Migration...
✅ Migration successful.
Stubs Customization
You can customize the stub templates by copying them to resources/stubs/:
mkdir -p resources/stubs cp -r vendor/mdarmancse/autolara/stubs resources/stubs
Then modify the stub files inside resources/stubs/ to fit your project requirements.
Available Field Types
The package supports the following field types:
stringintegerbooleantextdatedatetimefloatdouble
Troubleshooting
1. Stub File Not Found Error
If you encounter this error:
❌ Error: Stub file not found: vendor/mdarmancse/autolara/stubs/model.stub
Try running:
php artisan config:clear && php artisan cache:clear
If the issue persists, ensure that the stub files exist in the vendor/mdarmancse/autolara/stubs/ directory.
2. Migration File Not Found Error
If you see:
❌ Error: File does not exist at path database/migrations/xxxx_xx_xx_xxxxxx_create_products_table.php
Manually run:
php artisan migrate
🚀 Happy Coding!
统计信息
- 总下载量: 19
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 3
- 点击次数: 2
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2025-02-18