Migration Guide
Migration from old YAML format
If you're upgrading from an older version of this package, here's how the YAML format has changed:
Old format (deprecated):
Product:
generate:
model: true
migration: true
controller: true
service: true
request: true
resource: true
collection: true
seeder: false
fields:
name: string:unique
relations:
creator:
type: belongsTo
model: User
variants:
type: hasMany
model: ProductVariant
makeRequest: true
New format (current):
Product:
generate_except: seeder # Much simpler!
fields:
name: string:unique
relations:
belongsTo: User:creator
hasMany: ProductVariant:variants
nested_requests: variants
Key differences:
- Generation control: Use
generate_onlyorgenerate_exceptinstead of individual boolean flags - Compact relations: Use
relationType: Model:functionNameformat instead of nested arrays - Nested requests: Use
nested_requestsat model level instead ofmakeRequestper relation - Cleaner syntax: Less YAML nesting, easier to read and maintain
The package still supports the old format for backward compatibility, but we recommend migrating to the new format for better maintainability.
Conventions and output locations
- Models:
app/Models/{Model}.php - Migrations:
database/migrations/*_create_{table}_table.php - Controllers:
app/Http/Controllers/{Model}Controller.php - Services:
app/Services/{Model}Service.php - Requests:
app/Http/Requests/{Model}Request.php - Resources:
app/Http/Resources/{Model}Resource.php - Collections:
app/Http/Resources/{Model}Collection.php - Seeders:
database/seeders/{Model}Seeder.php - Routes: Appended to
routes/api.phpor your configured route file - Postman:
module/postman_collection.json - DBML:
module/dbdiagram.dbml - Backups:
module/backups/{timestamp}/
If you need additional generator behaviors (custom templates, naming conventions), consider extending the package or contributing a PR.