# Module Generator (Admin UI) A visual tool for creating module skeletons through the Filament admin panel. > **Development Only**: This tool is only available when `APP_ENV=local`. ## Access Navigate to: **Admin Panel → Development → Module Generator** URL: `/admin/module-generator` ## Features - **Visual Form**: Create modules without command line - **Auto Git Branch**: Optionally creates `module/{name}` branch and commits files - **Skeleton Only**: Maximum flexibility - creates structure, you add the models - **Instant Feedback**: Shows generation logs and next steps ## What Gets Created ``` app/Modules/{ModuleName}/ ├── Config/{module_name}.php # Module configuration ├── Database/ │ ├── Migrations/ # Empty, add your migrations │ └── Seeders/ # Empty, add your seeders ├── Filament/Resources/ # Empty, add Filament resources ├── Http/ │ ├── Controllers/{ModuleName}Controller.php │ ├── Middleware/ # Empty │ └── Requests/ # Empty ├── Models/ # Empty, add your models ├── Policies/ # Empty, add policies ├── Services/ # Empty, add services ├── Routes/ │ ├── web.php # Basic index route │ └── api.php # If API option selected ├── Resources/views/ │ └── index.blade.php # Starter view ├── Permissions.php # CRUD permissions ├── {ModuleName}ServiceProvider.php # Auto-registered └── README.md # Module documentation ``` ## Form Options | Field | Description | |-------|-------------| | **Module Name** | PascalCase name (e.g., `Accounting`, `Inventory`) | | **Description** | Brief description for README and config | | **Create Git Branch** | Auto-create `module/{name}` branch and commit | | **Include API Routes** | Add `Routes/api.php` with Sanctum auth | ## Git Integration When "Create Git Branch" is enabled: 1. **Checks** for uncommitted changes (fails if dirty) 2. **Creates** branch `module/{module-name}` 3. **Generates** all module files 4. **Commits** with message `feat: Add {ModuleName} module skeleton` 5. **Shows** push command: `git push -u origin module/{name}` ### Requirements - Working directory must be clean (no uncommitted changes) - Git must be installed in the container - Repository must be initialized ## After Generation 1. **Run migrations** (if you add any): ```bash php artisan migrate ``` 2. **Seed permissions**: ```bash php artisan db:seed --class=RolePermissionSeeder ``` 3. **Clear caches**: ```bash php artisan optimize:clear ``` 4. **Push branch** (if Git was used): ```bash git push -u origin module/{name} ``` ## Adding Models After generating the skeleton, add models manually: ```php // app/Modules/Accounting/Models/Invoice.php