Skip to main content

Comprehensive Usage Example: Building a “Support Ticket” Module

Goal: Scaffold a full CRUD interface for managing support tickets. 1. The All-in-One YAML Definition File Create a file named support_ticket_module.yml somewhere in your project (e.g., in a crud_definitions/ directory).
2. The Artisan Command to Run Open your terminal in the root of your Laravel project and run the single make:module-crud command:
  • crud_definitions/support_ticket_module.yml: The path to the file you just created.
  • --single-yml: This is the crucial flag that tells the command to look for form:, view:, table:, etc., inside this one file.
3. Expected Output After running the command, you will see output from the orchestrator and each of its sub-commands. The following file structure will be created/updated:
4. Post-Generation Steps (Developer’s TODO List)
  1. Define Routes: Open routes/web.php and add the resourceful route:
  1. Run Migrations: Create a migration for your tickets table/collection that includes all the fields defined in the schema_fields section.
  2. Implement Controller Logic:
  • Open app/Http/Controllers/Support/TicketController.php.
  • Fill in the $validator_create and $validator_update arrays with proper Laravel validation rules (the generator makes a guess, but you should refine it).
  • In the additionalQuery method, add any necessary Eloquent with() clauses to eager-load relationships (e.g., ->with('assignedAgent')).
  • In index(), view(), edit(), pass any necessary extra data to the Inertia pages (e.g., a list of agents for a select dropdown).
  • Implement the actual database saving logic in store() and update() if you override them from the AdminController base.
  1. Implement Page Logic:
  • Open resources/js/Pages/Support/Ticket/Create.vue and Edit.vue.
  • Inside the <TicketForm> component slot, implement the UI for the array_object_manager (#form_relatedTasks).
  • Provide the formatters object for the ArrayObjectManager via the form props if needed.
  • Open resources/js/Pages/Support/Ticket/View.vue.
  • Provide the formatters object with functions for statusBadge, booleanIcon, markdown, starRating, attachmentList etc., to be passed to <TicketDetailView>.
  • Implement handlers for @onPointClick and @map_viewport_change if you plan to use them.
  1. Create Helper Files:
  • Ensure your resources/js/utils/formatters.ts file exists and contains the formatter functions (statusBadge, booleanIcon, etc.) referenced in your YAML.
This example provides a concrete workflow, from a single comprehensive YAML file to a nearly complete, functional CRUD module, showcasing the power and efficiency of the generator system you’ve built.