Overriding Models
The Custom Fields package allows you to replace the default models with your own implementations.Registering Custom Models
Register your custom models using theCustomFields
class:
Configuration File
The configuration file (config/custom-fields.php
) allows you to customize all aspects of the Custom Fields package. It uses modern fluent configurators for type safety and better IDE support.
Entity Configuration
Configure which models can have custom fields:Field Types Configuration
Control which field types are available:Features Configuration
Configure package features using the enum-based system:Management Interface
Configure the custom fields management page:Database Configuration
Customize table names and paths:Available Features
The package supports these features that can be enabled/disabled:Feature | Description |
---|---|
FIELD_CONDITIONAL_VISIBILITY | Show/hide fields based on conditions |
FIELD_ENCRYPTION | Encrypt sensitive field values |
FIELD_OPTION_COLORS | Color-coded options for select fields |
UI_TABLE_COLUMNS | Show custom fields as table columns |
UI_TOGGLEABLE_COLUMNS | Allow users to toggle column visibility |
UI_TABLE_FILTERS | Enable filtering by custom field values |
SYSTEM_MANAGEMENT_INTERFACE | Enable the management interface |
SYSTEM_MULTI_TENANCY | Enable multi-tenant isolation |
Overriding Models
The Custom Fields package allows you to replace the default models with your own implementations.Registering Custom Models
Register your custom models using theCustomFields
class:
Configuration Examples
Restricting Field Types
Limit available field types in production:Performance Configuration
Optimize for production:Multi-Tenancy Setup
Enable tenant isolation:Minimal Configuration
For a simple setup with basic features:Best Practices
Performance Optimization
- Enable Caching: Always enable caching in production
- Limit Discovery: Only discover models you need
- Restrict Field Types: Only enable field types you use
Security Considerations
- Disable Unused Features: Turn off features you don’t need
- Restrict Field Types: Disable potentially unsafe field types like rich editors
- Enable Multi-Tenancy: Always enable in multi-tenant applications