PHPackages                             ganyicz/nova-temporary-fields - 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. ganyicz/nova-temporary-fields

ActiveLibrary

ganyicz/nova-temporary-fields
=============================

Make Laravel Nova fields temporary

1.1.1(4y ago)97.4k↓100%3MITPHPPHP ^7.2.5|^8.0

Since Mar 20Pushed 4y ago2 watchersCompare

[ Source](https://github.com/ganyicz/nova-temporary-fields)[ Packagist](https://packagist.org/packages/ganyicz/nova-temporary-fields)[ RSS](/packages/ganyicz-nova-temporary-fields/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (3)Dependencies (1)Versions (4)Used By (0)

Make any Laravel Nova field temporary
=====================================

[](#make-any-laravel-nova-field-temporary)

This package adds support for creating fields you don't want to persist in your models.

```
use Illuminate\Http\Request;
use Laravel\Nova\Fields\Text;
use Ganyicz\NovaTemporaryFields\HasTemporaryFields;

class User extends Resource
{
    use HasTemporaryFields;

    public function fields(Request $request)
    {
        return [
          Text::make('Non existent')->temporary()
        ];
    }
}
```

Why?
----

[](#why)

This package is meant to be used in conjunction with my other package [Nova Callbacks](https://github.com/ganyicz/nova-callbacks).

Let's say you have a Product model with multiple prices depending on a currency defined in the Pricing model.

```
class Product extends Model
{
  // ...

  public function pricing()
  {
    return $this->hasMany(Pricing::class);
  }
}
```

Now normally, you would use something like HasMany field on your Product resource. Although, this is not very intuitive for the admin. When he wants to update the product's pricing, he needs to go to the detail page and either create new pricing record or update an existing one. Not great.

What if you just wanted to have a price field for every currency, right inside your edit page? Let's look at the solution.

```
use Illuminate\Http\Request;
use Ganyicz\NovaCallbacks\HasCallbacks;
use Ganyicz\NovaCallbacks\HasTemporaryFields;

class User extends Resource
{
    use HasTemporaryFields,
        HasCallbacks;

    public function fields(Request $request)
    {
        return [
          // For the sake of simplicity, I'm not resolving the current price

          Number::make('USD')
            ->required()
            ->temporary(),

          Number::make('EUR')
            ->required()
            ->temporary(),
        ];
    }

    public static function afterSave(Request $request, $model)
    {
      $model->pricing()->firstOrNew(['currency' => 'USD'])->fill(['price' => $request->input('USD')])->save();
      $model->pricing()->firstOrNew(['currency' => 'EUR'])->fill(['price' => $request->input('EUR')])->save();
    }
}
```

Pretty elegant, right?

By defining a field as temporary, Nova won't try to fill the attribute to your model, avoiding the `Column not found` exception. Although you still have access to it inside your request.

The possibilties are endless.

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

[](#installation)

You can install the package via composer:

```
composer require ganyicz/nova-temporary-fields
```

Usage
-----

[](#usage)

1. Apply `HasTemporaryFields` trait on your resource.
2. Chain `temporary()` method on any field you don't want to fill to your model.

TIP: Apply the trait on your base Resource class inside your Nova folder so that temporary fields are available for you in every new resource.

How does it work?
-----------------

[](#how-does-it-work)

This package defines a `temporary()` macro on the base `Field` abstract class, which just sets a meta attribute `_temp` to true. The `HasTemporaryFields` trait overrides `fillFields` method on your Resource and filters out any fields with this meta attribute.

###  Health Score

33

—

LowBetter than 74% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity29

Limited adoption so far

Community12

Small or concentrated contributor base

Maturity59

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 85.7% 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 ~55 days

Total

3

Last Release

1765d ago

PHP version history (2 changes)1.0.0PHP ^7.2.5

1.1.0PHP ^7.2.5|^8.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/01cfffb593c2e79d752f1df4099b816cf93419a61d4d9ebcca66675bdae4e450?d=identicon)[ganyicz](/maintainers/ganyicz)

---

Top Contributors

[![ganyicz](https://avatars.githubusercontent.com/u/3823354?v=4)](https://github.com/ganyicz "ganyicz (6 commits)")[![rickkuilman](https://avatars.githubusercontent.com/u/7881219?v=4)](https://github.com/rickkuilman "rickkuilman (1 commits)")

### Embed Badge

![Health badge](/badges/ganyicz-nova-temporary-fields/health.svg)

```
[![Health](https://phpackages.com/badges/ganyicz-nova-temporary-fields/health.svg)](https://phpackages.com/packages/ganyicz-nova-temporary-fields)
```

###  Alternatives

[optimistdigital/nova-sortable

This Laravel Nova package allows you to reorder models in a Nova resource's index view using drag &amp; drop.

2872.1M6](/packages/optimistdigital-nova-sortable)[outl1ne/nova-sortable

This Laravel Nova package allows you to reorder models in a Nova resource's index view using drag &amp; drop.

2861.8M9](/packages/outl1ne-nova-sortable)[laravel/nova-log-viewer

A Laravel Nova tool for viewing your application logs.

136301.3k1](/packages/laravel-nova-log-viewer)[stepanenko3/nova-command-runner

Laravel Nova tool for running Artisan and bash(shell) commands.

36983.0k](/packages/stepanenko3-nova-command-runner)[sbine/route-viewer

A Laravel Nova tool to view your registered routes.

57215.9k](/packages/sbine-route-viewer)[dniccum/nova-documentation

A Laravel Nova tool that allows you to add markdown-based documentation to your administrator's dashboard.

37116.4k](/packages/dniccum-nova-documentation)

PHPackages © 2026

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