Usage
- Open the Code Generator UI
- Visit the following route in your browser: /code-generator or your customized route path.
Prefill Fields from SQL Table Query
This feature allows you to automatically populate model fields by parsing a SQL CREATE TABLE query.
- 🔧 How It Works
- Paste a SQL
CREATE TABLEstatement into the provided textarea. - Click the "Prefill" button.
- It auto-fills:
model_name: Converted to singular, PascalCase.fieldsData: Populated withcolumn_name,data_type, and default values.
- Duplicate column names are ignored and reported.
- A success message shows how many fields were added.
Define Model & Fields
Enter the Model Name
Add fields with their: Name , Data type , Validation rules ,Foreign key options (for relations)
Define Relationships Choose relationship type (e.g., hasOne, belongsTo, hasMany, belongsToMany) Select target model and relationship keys.
Select Files , Methods and Traits you want to Generate.
Generate Files
- Click "Generate" to generate the selected files.
- All files will be created in the paths defined in your config file, following Laravel conventions.