Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -346,7 +346,7 @@ php artisan enumify:sync --quiet

### enumify:refactor

Scan your codebase for hardcoded enum values and refactor them to use proper enum references. This command also supports normalizing enum case names to UPPERCASE and updating all references throughout your application.
Scan your codebase for hardcoded enum values and refactor them to use proper enum references. Only columns with enum casts in models will be refactored. This command also supports normalizing enum case names to UPPERCASE and updating all references throughout your application.

#### Available Options

Expand All @@ -361,7 +361,6 @@ Scan your codebase for hardcoded enum values and refactor them to use proper enu
| `--backup` | | Create backups before applying changes |
| `--include=` | | File patterns to include (e.g., `*.php`) |
| `--exclude=` | | Paths or patterns to exclude from scanning |
| `--strict` | | Strict matching (column name must match enum context) |
| `--report=` | | Export report to file (formats: `json`, `csv`, `md`) |
| `--detailed` | | Show detailed output with code context |
| `--normalize-keys` | | Convert enum keys to UPPERCASE and fix all references |
Expand All @@ -388,6 +387,8 @@ php artisan enumify:refactor --path=app/Services
php artisan enumify:refactor --report=refactor-report.md
```

**Note:** The refactor command only processes columns that have an enum cast defined in a model. If no cast is available for a column, it will skip refactoring for that column.

#### Key Normalization (UPPERCASE)

The `--normalize-keys` flag converts enum case names from any case format to UPPERCASE and updates all references in your codebase:
Expand Down
3 changes: 3 additions & 0 deletions config/enumify.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@
'paths' => [
// Directories to scan for PHP enums (relative to base_path)
'enums' => ['app/Enums'],
// Directories to scan for Laravel models (relative to base_path)
// Used by enumify:refactor to detect enum casts
'models' => ['app/Models'],
// Output directory for generated TypeScript files (relative to base_path)
'output' => 'resources/js/enums',
],
Expand Down
Loading