PHPackages                             byjesper/laravel-custom-fields-filament - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Admin Panels](/categories/admin)
4. /
5. byjesper/laravel-custom-fields-filament

ActiveLibrary[Admin Panels](/categories/admin)

byjesper/laravel-custom-fields-filament
=======================================

Filament admin UI for byjesper/laravel-custom-fields.

v2.0.2(1mo ago)04[9 issues](https://github.com/byjesper/laravel-custom-fields-filament/issues)[1 PRs](https://github.com/byjesper/laravel-custom-fields-filament/pulls)MITPHPPHP ^8.4CI passing

Since May 28Pushed 1mo agoCompare

[ Source](https://github.com/byjesper/laravel-custom-fields-filament)[ Packagist](https://packagist.org/packages/byjesper/laravel-custom-fields-filament)[ RSS](/packages/byjesper-laravel-custom-fields-filament/feed)WikiDiscussions main Synced 2w ago

READMEChangelogDependencies (24)Versions (9)Used By (0)

Laravel Custom Fields — Filament
================================

[](#laravel-custom-fields--filament)

Filament v5 admin UI for [`byjesper/laravel-custom-fields`](https://packagist.org/packages/byjesper/laravel-custom-fields).

Plug-and-play resources, form components, and table columns for managing custom field definitions and editing per-record values inside any Filament panel.

What's included
---------------

[](#whats-included)

- **`CustomFieldDefinitionResource`** — full CRUD for definitions (list / create / edit) with grouping, validation rules, conditional visibility, and per-type config.
- **`CustomFieldForm::make($entityType, ?$record)`** — builds the form schema for an entity, automatically grouped into two-level collapsible sections driven by `group_level_1` / `group_level_2`.
- **`CustomFieldInfolist::make($entityType, ?$record)`** — builds the matching read-only infolist schema, with type-aware display values and the same grouping as the form.
- **`CustomFieldTableColumn::make($entityType)`** — returns toggleable table columns for every active custom field, with proper formatting for selects, relationships, dates, ranges, and booleans.
- **`CustomFieldTableFilter`** — table filter components backed by `CustomFieldQueryBuilder`, including date/time range filters.
- **`HandlesCustomFieldFormData`** trait — shapes raw form data into the `['value' => …]` envelope and validates with the host model.
- **`ConditionalVisibility` rule** — server-side enforcement of the same rule tree the form uses for visibility.

Requirements
------------

[](#requirements)

- PHP **8.4+**
- Laravel **13.x**
- Filament **5.x**
- `byjesper/laravel-custom-fields` **^1.1**

Installation
------------

[](#installation)

```
composer require byjesper/laravel-custom-fields-filament
```

Make sure the core package is installed and migrated (see its [README](https://github.com/byjesper/laravel-custom-fields/blob/main/README.md)).

### Register the plugin

[](#register-the-plugin)

In your panel provider:

```
use Filament\Panel;
use ByJesper\LaravelCustomFieldsFilament\CustomFieldsPlugin;

public function panel(Panel $panel): Panel
{
    return $panel
        // ...
        ->plugins([
            CustomFieldsPlugin::make(),
        ]);
}
```

This registers `CustomFieldDefinitionResource` in the panel — admins can now manage definitions at `/admin/custom-field-definitions`.

Editing custom fields on your own resources
-------------------------------------------

[](#editing-custom-fields-on-your-own-resources)

Inside any Filament resource form, drop in the generated schema for that entity:

```
use Filament\Schemas\Schema;
use ByJesper\LaravelCustomFieldsFilament\Components\CustomFieldForm;

public static function form(Schema $schema): Schema
{
    return $schema->components([
        // ...your native form fields...

        ...CustomFieldForm::make('contact', $schema->getRecord()),
    ]);
}
```

Fields are namespaced under `custom.*` (e.g. `custom.lifetime_value`) so they don't collide with native model attributes. Use the `HandlesCustomFieldFormData` trait on your `Create`/`Edit` pages to shape and validate the payload before saving:

```
use ByJesper\LaravelCustomFieldsFilament\Concerns\HandlesCustomFieldFormData;

class EditContact extends EditRecord
{
    use HandlesCustomFieldFormData;

    protected function mutateFormDataBeforeSave(array $data): array
    {
        $custom = $data['custom'] ?? [];
        unset($data['custom']);

        $this->validateCustomFieldsInData($custom);
        $data['custom_field_values'] = $this->buildCustomFieldValues($custom);

        return $data;
    }
}
```

The `custom_field_values` column is observed by the core package, which mirrors changes into `custom_field_index_values` on save.

Displaying custom fields in infolists
-------------------------------------

[](#displaying-custom-fields-in-infolists)

Use the read-only counterpart on a View/detail page. Pass the displayed model so the component can read values through the core package's `getCustomFieldValue()` accessor:

```
use Filament\Schemas\Components\Tabs\Tab;
use Illuminate\Database\Eloquent\Model;
use ByJesper\LaravelCustomFieldsFilament\Components\CustomFieldInfolist;

Tab::make(__('fields.custom_fields'))
    ->schema(fn (?Model $record) => CustomFieldInfolist::make('contact', $record));
```

The infolist is display-only. It does not apply form defaults or conditional visibility rules, so a field hidden by a form condition remains visible on the detail page in this release.

Showing custom fields in tables
-------------------------------

[](#showing-custom-fields-in-tables)

```
use Filament\Tables\Table;
use ByJesper\LaravelCustomFieldsFilament\Components\CustomFieldTableColumn;

public static function table(Table $table): Table
{
    return $table->columns([
        // ...your native columns...

        ...CustomFieldTableColumn::make('contact'),
    ]);
}
```

The helper picks a sensible column type per field type — `IconColumn` for booleans, `TextColumn` for everything else — and resolves select labels and relationship display fields automatically. All custom-field columns are `toggleable()` so they can be hidden from the column picker by default if the list is long.

Filtering by custom fields
--------------------------

[](#filtering-by-custom-fields)

```
use ByJesper\LaravelCustomFieldsFilament\Components\CustomFieldTableFilter;

$table->filters([
    ...CustomFieldTableFilter::make('contact'),
]);
```

Field-type → Filament component mapping
---------------------------------------

[](#field-type--filament-component-mapping)

Field typeComponent`string``TextInput``text``Textarea` (4 rows)`integer``TextInput` numeric`decimal``TextInput` numeric, step from `config.scale``boolean``Toggle``date``DatePicker``datetime``DateTimePicker``time``TimePicker``date_range``Fieldset` with two `DatePicker` fields`datetime_range``Fieldset` with two `DateTimePicker` fields`time_range``Fieldset` with two `TimePicker` fields`select` / `enum``Select` with options from `config.options``multi_select``CheckboxList``relationship`searchable `Select` pulling from `custom-fields.relationships.targets``json``Textarea` with JSON encode/decode`CustomFieldInfolist` maps the same types to read-only entries: booleans use icons; dates and times use Filament's display formatting; select values and relationships resolve to labels; multi-select values render as badges; text and JSON values span the full width.

Type configuration
------------------

[](#type-configuration)

The definition resource exposes type-specific configuration supplied by the core package. For temporal fields this currently includes:

- `time`: optional `config.step_minutes`
- `time_range`: optional `config.step_minutes` and `config.allow_overnight`

Date, datetime, time, and their range variants expose type-aware validation controls for required, fixed `min` / `max`, and relative date/datetime bounds. Relative date rules use the `today` anchor; relative datetime rules use `now`. Time fields intentionally support fixed bounds only.

Conditional visibility
----------------------

[](#conditional-visibility)

Forms generated by `CustomFieldForm::make()` automatically wire each field's `conditional_visibility` rules into Filament's reactive `visible(fn (Get $get) => ...)` callbacks — no extra setup. For server-side enforcement (e.g. preventing values from being saved for hidden fields), use the included `ConditionalVisibility` rule.

Grouping
--------

[](#grouping)

Definitions are rendered into a two-level layout:

- `group_level_1` → outer collapsible `Section`
- `group_level_2` → inner collapsible `Section` (defaults to "General")
- `sort_order` → order within a group

Definitions with no `group_level_1` are emitted at the top level.

Development
-----------

[](#development)

The following Composer scripts are available for local quality checks:

```
# Format code automatically
composer lint

# Run all checks that CI runs
composer test

# Individual checks
composer test:lint        # Rector + Pint (dry-run)
composer test:type:check  # PHPStan Level 8
composer test:unit        # Pest unit tests

# Additional scripts (enforced by #7)
composer test:parallel       # Parallel unit tests
composer test:integration    # Integration tests
composer test:type:coverage  # Type coverage with Pest
composer update:snapshots    # Update Pest snapshots
```

The `composer test` aggregate runs the full package quality gate: lint, type-check, type coverage, unit tests, parallel tests, and integration tests.

License
-------

[](#license)

MIT — see [LICENSE.md](LICENSE.md).

###  Health Score

41

—

FairBetter than 87% of packages

Maintenance90

Actively maintained with recent releases

Popularity3

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity56

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~4 days

Total

7

Last Release

45d ago

Major Versions

v1.2.0 → v2.0.02026-06-23

### Community

Maintainers

![](https://www.gravatar.com/avatar/7fe91059b591a5df0a6c3a69bd89e13875e03a2dcc0e046125181b6edd72b92a?d=identicon)[Yezper](/maintainers/Yezper)

---

Top Contributors

[![Yezper](https://avatars.githubusercontent.com/u/9988723?v=4)](https://github.com/Yezper "Yezper (20 commits)")

###  Code Quality

TestsPest

Static AnalysisPHPStan, Rector

Code StyleLaravel Pint

Type Coverage Yes

### Embed Badge

![Health badge](/badges/byjesper-laravel-custom-fields-filament/health.svg)

```
[![Health](https://phpackages.com/badges/byjesper-laravel-custom-fields-filament/health.svg)](https://phpackages.com/packages/byjesper-laravel-custom-fields-filament)
```

###  Alternatives

[a2insights/filament-saas

Filament Saas for A2Insights

191.8k](/packages/a2insights-filament-saas)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
