- How do I add custom fields to a Filament admin panel without migrations?
- Install the package via Composer, register the `CustomFieldsPlugin` in your Filament panel configuration, and use the `UsesCustomFields` trait on your Eloquent model. The package stores fields in JSON, so no database migrations are required. Simply include `CustomFields::form()->build()` in your Filament form schema to display them.
- Does this package support Laravel 13?
- The package has PHPStan fixes for Laravel 13 compatibility, but it’s not officially supported yet. Test thoroughly, especially Eloquent Scope behavior, as Laravel 13 introduces changes like updated Scope signatures. Check the GitHub issues for updates on native Laravel 13 support.
- Can I use conditional visibility to show/hide fields based on other field values?
- Yes, the package includes conditional visibility logic. You can configure fields to appear or disappear based on other field values in your Filament forms or tables. A recent bug fix (preventing self-clear of `field_code`) improves stability for visibility conditions, but ensure your logic is well-documented for complex use cases.
- How do I handle multi-tenancy with custom fields?
- The package provides built-in tenant isolation, but you must explicitly handle tenant context switching in your application. Use the `tenant()` method or middleware to ensure fields are scoped correctly per tenant. For large-scale applications, consider caching tenant-specific field configurations to optimize performance.
- What field types are available, and can I add custom ones?
- The package includes 20+ field types like text, date, select, file uploads, and rich editors. You can extend it by creating custom field types and publishing them via the package’s discovery system. Documentation covers how to register and validate custom fields in your application.
- Is there a performance impact from storing custom fields in JSON?
- Yes, JSON storage can impact query performance, especially for complex queries or large datasets. The package recommends using indexed columns for frequently queried fields and avoiding deep nesting. For production, consider denormalizing critical fields or using database views to mitigate overhead.
- How do I import/export custom fields via CSV?
- The package includes built-in CSV import and export functionality. Use the `CustomFields::export()` and `CustomFields::import()` methods in your Filament resources or controllers. For large datasets, process exports/imports asynchronously with Laravel queues to avoid timeouts or memory issues.
- Can I encrypt sensitive custom fields?
- Yes, the package supports optional field encryption. Configure encryption keys in your `.env` file and mark fields as encrypted in their definitions. Encrypted fields are automatically handled during storage and retrieval, ensuring sensitive data remains secure.
- Will this work with Filament 3.x and Laravel 12?
- Absolutely. The package is designed for Filament 3.x and Laravel 12 (PHP 8.3+). While Laravel 13 compatibility is improving, stick to Laravel 12 for guaranteed stability. Always check the package’s GitHub repository for version-specific updates or breaking changes.
- Are there alternatives to this package for dynamic custom fields in Laravel?
- Yes, alternatives include `spatie/laravel-medialibrary` for media fields, `orchid/fields` for Orchid CMS, or `laravel-nova-custom-fields` for Nova. However, this package is uniquely tailored for Filament, offering deep integration with Filament’s forms, tables, and admin UI. Evaluate your stack—Filament-specific solutions may offer better performance and consistency.