PHPackages                             marshmallow/prefiller-field - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. marshmallow/prefiller-field

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

marshmallow/prefiller-field
===========================

A Laravel Nova field to prefill fields based on another field. Super Awesome!

2.3.1(2y ago)23.9k↓67.5%1[1 PRs](https://github.com/marshmallow-packages/prefiller-field/pulls)MITPHPPHP ^7.1|^8.0CI passing

Since Sep 24Pushed 2w ago1 watchersCompare

[ Source](https://github.com/marshmallow-packages/prefiller-field)[ Packagist](https://packagist.org/packages/marshmallow/prefiller-field)[ RSS](/packages/marshmallow-prefiller-field/feed)WikiDiscussions main Synced 2d ago

READMEChangelog (6)DependenciesVersions (17)Used By (0)

[![alt text](https://camo.githubusercontent.com/f5450f299f5713ce2f04dd5a1ba7ce9960ed4568b3574e4c4ee3cddc75477253/68747470733a2f2f6d617273686d616c6c6f772e6465762f63646e2f6d656469612f6c6f676f2d7265642d3233377834362e706e67 "marshmallow.")](https://camo.githubusercontent.com/f5450f299f5713ce2f04dd5a1ba7ce9960ed4568b3574e4c4ee3cddc75477253/68747470733a2f2f6d617273686d616c6c6f772e6465762f63646e2f6d656469612f6c6f676f2d7265642d3233377834362e706e67)

Nova Prefiller Field
====================

[](#nova-prefiller-field)

[![Latest Version on Packagist](https://camo.githubusercontent.com/91805a44370b9b94c84533cc5c3eac3af2e5bcbf1c7de2572def6a0b3df3d706/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6d617273686d616c6c6f772f70726566696c6c65722d6669656c642e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/marshmallow/prefiller-field)[![PHP Syntax Checker](https://camo.githubusercontent.com/7aa4979c35a3e0d467e744dc8b4d4e7ee456751cb8de96d43393bfb92f7b5f7b/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f6d617273686d616c6c6f772d7061636b616765732f70726566696c6c65722d6669656c642f7068702d73796e7461782d636865636b65722e796d6c3f6272616e63683d6d61696e266c6162656c3d73796e746178267374796c653d666c61742d737175617265)](https://github.com/marshmallow-packages/prefiller-field/actions/workflows/php-syntax-checker.yml)[![Total Downloads](https://camo.githubusercontent.com/503f64e1331ba58befd2aa116d6980524fabb41fdaeab67e69916b011ac2ed99/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6d617273686d616c6c6f772f70726566696c6c65722d6669656c642e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/marshmallow/prefiller-field)

A Laravel Nova field to prefill fields based on another field. Super Awesome!

When a source field (for example a `BelongsTo` relation) changes in a Nova form, the prefiller field looks up the selected model and fills itself with a value taken from that model — either an attribute or a method on it.

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

[](#installation)

Install the package via Composer:

```
composer require marshmallow/prefiller-field
```

The package registers its service provider automatically through Laravel's package discovery, so there is nothing else to set up.

Usage
-----

[](#usage)

Use the prefiller fields inside a Nova resource's `fields()` method. Point each field at the source field with `sourceField()`, tell it which model to look up with `sourceModel()`, and choose the attribute or method to copy with `prefillWith()`.

```
use Laravel\Nova\Fields\BelongsTo;
use Marshmallow\PrefillerField\PrefillerText;
use Marshmallow\PrefillerField\PrefillerCurrency;

public function fields(Request $request)
{
    return [
        BelongsTo::make('Product')->nullable()->searchable(),

        PrefillerText::make('Test', 'field_2')
            ->sourceField('product')
            ->sourceModel(\Marshmallow\Product\Models\Product::class)
            ->prefillWith('name'), // This can be a field or a method on your target resource

        PrefillerCurrency::make('Test 3', 'field_3')
            ->sourceField('product')
            ->sourceModel(\Marshmallow\Product\Models\Product::class)
            ->prefillWith('price')
            ->currency('EUR')
            ->default(0)
            ->nullable(),
    ];
}
```

### Available methods

[](#available-methods)

Every prefiller field inherits the standard Nova field methods plus the following helpers from the `Prefillable` trait:

MethodDescription`sourceField($source_field)`The attribute of the field that triggers the prefill (for example the `BelongsTo` relation).`sourceModel($source_model)`The fully-qualified model class that is looked up when the source field changes.`prefillWith($prefill_with)`The attribute or method on the looked-up model whose value is used to prefill the field.`allowUpdatingFilledFields()`Re-check for new values even when the target field already has content (by default a filled field is left untouched).`fieldType($type)`Override the field type passed to the front-end component.### Extra methods

[](#extra-methods)

If you want the prefiller to check for new values, even if the target field is already filled with content, you can call the method `allowUpdatingFilledFields()`.

### Supported fields

[](#supported-fields)

Currently we have only implemented the `Text` and `Currency` fields because we needed them in a project for a customer. We will add more in the coming months. Feel free to send a pull request if you need another field for your project.

- `Marshmallow\PrefillerField\PrefillerText` — extends Nova's `Text` field.
- `Marshmallow\PrefillerField\PrefillerCurrency` — extends Nova's `Currency` field.

Security Vulnerabilities
------------------------

[](#security-vulnerabilities)

If you discover any security related issues, please email  instead of using the issue tracker.

Credits
-------

[](#credits)

- [Marshmallow](https://github.com/marshmallow-packages)
- [All Contributors](https://github.com/marshmallow-packages/prefiller-field/contributors)

License
-------

[](#license)

The MIT License (MIT). Please see the [License File](LICENSE.md) for more information.

###  Health Score

45

—

FairBetter than 91% of packages

Maintenance63

Regular maintenance activity

Popularity24

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity68

Established project with proven stability

 Bus Factor1

Top contributor holds 73.8% 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 ~95 days

Recently: every ~2 days

Total

12

Last Release

1064d ago

Major Versions

v1.0.4 → 2.0.02023-07-05

PHP version history (2 changes)v1.0.0PHP &gt;=7.1.0

v1.0.3PHP ^7.1|^8.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/be33d2624e24c516e73892b0929447cc762f3622c024ab8d0d2a59042e5d2c7f?d=identicon)[marshmallow](/maintainers/marshmallow)

---

Top Contributors

[![stefvanesch](https://avatars.githubusercontent.com/u/46725619?v=4)](https://github.com/stefvanesch "stefvanesch (31 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (11 commits)")

---

Tags

laravelnovamarshmallownova-fieldprefill

### Embed Badge

![Health badge](/badges/marshmallow-prefiller-field/health.svg)

```
[![Health](https://phpackages.com/badges/marshmallow-prefiller-field/health.svg)](https://phpackages.com/packages/marshmallow-prefiller-field)
```

###  Alternatives

[inspheric/nova-defaultable

Default values for Nova fields when creating resources and running resource actions.

52178.7k1](/packages/inspheric-nova-defaultable)[ferdiunal/nova-editable-field

A Laravel Nova package to make fields editable.

115.3k](/packages/ferdiunal-nova-editable-field)[datomatic/nova-detached-actions

A Laravel Nova tool to allow for placing actions in the Nova toolbar detached from the checkbox selection mechanism.

11273.0k](/packages/datomatic-nova-detached-actions)

PHPackages © 2026

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