UNPKG

kira-crud

Version:

Intelligent CRUD Generator for Laravel and Angular

99 lines (75 loc) 3.13 kB
# KIRA Configuration Examples This directory contains example configuration files for the KIRA CRUD generator. These examples demonstrate various aspects of the configuration format and can be used as starting points for your own configurations. ## Configuration Format KIRA supports both YAML and JSON configuration formats. YAML is recommended for its readability and support for comments. ## Example Configurations ### Basic CRUD Configuration `basic.yml` demonstrates a simple CRUD configuration for a basic model with standard fields. ### Relationship Examples - `belongs-to.yml`: Shows how to configure a model with belongsTo relationships - `has-many.yml`: Demonstrates hasMany relationship configuration - `many-to-many.yml`: Shows many-to-many relationship configuration with a pivot table - `polymorphic.yml`: Demonstrates polymorphic relationship configuration ### Advanced Features - `validation.yml`: Shows advanced validation rule configuration - `custom-ui.yml`: Demonstrates custom UI configuration options - `complex-model.yml`: A comprehensive example with multiple relationship types and validation rules ## Configuration Structure Each configuration file follows this general structure: ```yaml model: name: ModelName # PascalCase model name tableName: model_names # snake_case table name (plural) displayName: Model Name # Human-readable name description: Description text # Optional description # Fields definition fields: - name: id # Field name type: integer # Data type label: ID # Display label nullable: false # Whether null is allowed - name: name type: string label: Name validations: - required - max: 255 # More fields... # Relationships definition relationships: - name: category # Relationship name type: belongsTo # Relationship type model: Category # Related model displayField: name # Field to display required: true # Is relationship required? # More relationships... # UI configuration ui: tableFields: # Fields to show in table - id - name - category itemsPerPage: 10 # Default pagination enableSearch: true # Enable global search enableFilters: true # Enable column filters # Routing configuration routes: apiPrefix: api/model-names # API route prefix frontendPath: model-names # Frontend route path menuTitle: Model Names # Menu title menuIcon: fa-list # Menu icon ``` ## Using These Examples You can use these examples in several ways: 1. As a reference when creating your own configurations 2. As a starting point by copying and modifying them 3. To test the KIRA generator with pre-made configurations To use an example configuration: ```bash kira generate --config examples/basic.yml ``` Or through the interactive CLI: ```bash kira # Then select "Generate New CRUD" and choose the example ```