Skip to content

docs(console): add comprehensive documentation for make:model command#43

Merged
3m1n3nc3 merged 2 commits into
h3ravel:mainfrom
Sendi0011:docs/make-model-command
Sep 29, 2025
Merged

docs(console): add comprehensive documentation for make:model command#43
3m1n3nc3 merged 2 commits into
h3ravel:mainfrom
Sendi0011:docs/make-model-command

Conversation

@Sendi0011
Copy link
Copy Markdown
Contributor

Description

Adds comprehensive documentation for the musket make:model command, providing developers with detailed guidance on creating and managing Arquebus models in H3ravel applications.

Changes Made

  • 📚 Complete Command Guide: Detailed documentation of make:model usage and all available options
  • 📝 Naming Conventions: Comprehensive guide to model naming, file naming, and directory structure
  • 🏗️ Generated Model Examples: Shows actual generated file structure and complete model examples
  • 🔗 Integration Documentation: Covers migrations, controllers, factories, and route model binding
  • 🎯 Practical Examples: Real-world usage scenarios and command combinations
  • Best Practices: Model organization, security considerations, and development patterns
  • 🔧 Advanced Features: Relationships, scopes, attributes, casting, and common patterns

Documentation Includes

Command Usage

  • Basic model creation with proper naming conventions
  • Option combinations for different development scenarios
  • File type selection (TypeScript/JavaScript support)
  • Force overwrite functionality for existing models

Model Structure

  • Generated file structure based on actual stub template
  • Complete model examples showing real-world usage
  • Directory organization with nested model support
  • Naming conventions following H3ravel standards

Integration Coverage

  • Migration Integration: Automatic migration creation and table name guessing
  • Controller Integration: Route model binding and dependency injection
  • Factory Integration: Planned functionality and future usage patterns
  • Database Operations: CRUD operations, relationships, and query examples

Practical Examples

  • Basic model creation with various options
  • Model with migration and controller generation
  • Complete resource generation with --all flag
  • Nested models and custom directory structures
  • JavaScript model creation with --type=js

Advanced Topics

  • Route Model Binding: Automatic parameter resolution in controllers
  • Relationships: hasMany, belongsTo, hasOne, belongsToMany examples
  • Attributes & Casting: fillable, hidden, casts configuration
  • Best Practices: Security, organization, and naming patterns

Files Added

  • packages/console/docs/make-model.md - Comprehensive make:model command documentation

Validation

  • ✅ Documentation based on actual MakeCommand.ts implementation
  • ✅ Examples match real generated code from model stub template
  • ✅ Integration examples based on actual H3ravel patterns
  • ✅ Command options accurately reflect signature definition
  • ✅ File paths and naming match actual generation behavior

Key Features Documented

Command Options

  • --migration (-m) - Create migration file
  • --controller (-c) - Create controller
  • --factory (-f) - Create factory (when available)
  • --seeder (-s) - Create seeder (when available)
  • --resource (-r) - Generate resource controller
  • --api - Generate API controller
  • --all (-a) - Generate all related files
  • --type (-t) - Specify file type (ts/js)
  • --force - Overwrite existing files

Model Features

  • Arquebus Integration: Built on H3ravel's Eloquent-inspired ORM
  • Route Model Binding: Automatic parameter resolution
  • Mass Assignment: fillable and guarded attributes
  • Hidden Attributes: Sensitive data protection
  • Type Casting: Automatic attribute conversion
  • Timestamps: Automatic created_at/updated_at handling
  • Relationships: Full relationship support

Related Issues

Fixes #36

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Documentation update
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)

Checklist

  • Documentation follows H3ravel style guidelines
  • Command behavior accurately documented from source code
  • Examples are practical and match generated output
  • All command options and features covered comprehensively
  • Integration patterns explained clearly with working examples
  • Best practices included for security and organization
  • Troubleshooting and development workflow guidance provided

- Document make:model command usage and all available options
- Include model naming conventions and file structure
- Show example of generated model file with complete structure
- Cover integration with migrations, controllers, and factories
- Provide practical examples for different use cases
- Document route model binding and controller integration
- Include best practices for model organization and security
- Add troubleshooting and development workflow guidance

Fixes h3ravel#36
@Sendi0011
Copy link
Copy Markdown
Contributor Author

GM @3m1n3nc3 trust you are doing great? this PR is ready for review.

@Sendi0011
Copy link
Copy Markdown
Contributor Author

GM @3m1n3nc3 trust you are doing great? this PR is ready for review.

Can you please remove emojis from the documentation where applicable.

GM @3m1n3nc3 trust you are doing great? this PR is ready for review.

Can you please remove emojis from the documentation where applicable.

This has been resolved and it is ready for review

@3m1n3nc3 3m1n3nc3 merged commit 6602dfd into h3ravel:main Sep 29, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant