PHPackages                             lupennat/conditionals - 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. lupennat/conditionals

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

lupennat/conditionals
=====================

Laravel Nova - Conditionals

v1.1.0(2y ago)024MITPHPPHP ^7.4|^8.0

Since May 22Pushed 2y ago2 watchersCompare

[ Source](https://github.com/Lupennat/conditionals)[ Packagist](https://packagist.org/packages/lupennat/conditionals)[ RSS](/packages/lupennat-conditionals/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependencies (3)Versions (3)Used By (0)

1. [Requirements](#Requirements)
2. [Installation](#Installation)
3. [Usage](#Usage)
    1. [Conditional Field](#conditional-field)
    2. [ConditionalMany Field](#conditionalmany-field)

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

[](#requirements)

- `php: ^7.4 | ^8`
- `laravel/nova: ^4`

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

[](#installation)

You can install the package in to a Laravel app that uses [Nova](https://nova.laravel.com) via composer:

```
composer require lupennat/conditionals
```

Usage
-----

[](#usage)

### Conditional Field

[](#conditional-field)

Conditional Field can be used to switch a Field based on other fields values. It use native Nova `dependsOn` to intercept field changes, the conditions will be resolved in all pages (Index, Detail, Forms).

```
use Laravel\Nova\Fields\Boolean;
use Laravel\Nova\Fields\FormData;
use Laravel\Nova\Fields\Hidden;
use Laravel\Nova\Fields\Number;
use Laravel\Nova\Fields\Select;
use Laravel\Nova\Fields\Text;
use Laravel\Nova\Http\Requests\NovaRequest;
use Lupennat\Conditionals\Conditional;

class Item extends Resource
{

    public function fields(Request $request)
    {
        return [
            Select::make(__('Type'), 'type')->options([
                'boolean' => 'Boolean',
                'number' => 'Number',
                'not-exists' => 'No Value',
                'text' => 'Text'
            ]),
            Conditional::make(__('Value'))
                ->dependsOn(['type'], function (Conditional $field, NovaRequest $novaRequest, FormData $formData) {
                    return match ($formData->type) {
                        'boolean' => Boolean::make(__('Value'), 'value')->rules('required')
                        'number' => Number::make(__('Value'), 'value')->rules('required', 'min:10', 'max:100'),
                        'text' => Text::make(__('Value'), 'value')->rules('required'),
                        default =>  Hidden::make(__('Value'), 'value')->nullable()->fillUsing(function ($request, $model, $attribute) {
                            // always reset value to null
                            $model->{$attribute} = null;
                        })
                    }
                }),
        ];
    }
}
```

> If you do not want to store/change a value you can return null instead of a field.
> When null will be returned an Unfillable Field will be used.

### Conditional Field

[](#conditional-field-1)

ConditionalMany Field can be used to Display Inline a single Field for any Many Relation.

```
use Laravel\Nova\Fields\Boolean;
use Laravel\Nova\Fields\FormData;
use Laravel\Nova\Fields\Hidden;
use Laravel\Nova\Fields\Number;
use Laravel\Nova\Fields\Select;
use Laravel\Nova\Fields\Text;
use Laravel\Nova\Http\Requests\NovaRequest;
use Lupennat\Conditionals\ConditionalMany;

class ItemList extends Resource
{

    public function fields(Request $request)
    {
        return [
            ID::make()->sortable(),
            ConditionalMany::make('Item Value', 'items')
                ->each(
                    function ($item) {
                        return match ($item->type) {
                            'boolean' => Boolean::make(__('Value'), 'value')
                            'number' => Number::make(__('Value'), 'value'),
                            'text' => Text::make(__('Value'), 'value'),
                            default =>  Hidden::make(__('Value'), 'value')
                        }
                    }
                )
        ];
    }
}
```

> ConditionalMany Field can be used only on Index and Detail page.

###  Health Score

23

—

LowBetter than 27% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity50

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 ~0 days

Total

2

Last Release

1083d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/3cea30d9041841dbfc768dc8b690c0cf4fb3244073f9edaf08f9c8f9d04f470a?d=identicon)[lupennat](/maintainers/lupennat)

---

Top Contributors

[![Lupennat](https://avatars.githubusercontent.com/u/6160171?v=4)](https://github.com/Lupennat "Lupennat (5 commits)")

---

Tags

laravelnova

###  Code Quality

Code StylePHP CS Fixer

### Embed Badge

![Health badge](/badges/lupennat-conditionals/health.svg)

```
[![Health](https://phpackages.com/badges/lupennat-conditionals/health.svg)](https://phpackages.com/packages/lupennat-conditionals)
```

###  Alternatives

[eminiarts/nova-tabs

Laravel Nova - Tabs.

4624.1M20](/packages/eminiarts-nova-tabs)[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)[sbine/route-viewer

A Laravel Nova tool to view your registered routes.

57215.9k](/packages/sbine-route-viewer)[markwalet/nova-modal-response

A Laravel Nova asset for Modal responses on an action.

14720.0k](/packages/markwalet-nova-modal-response)[datomatic/nova-enum-field

A Laravel Nova PHP 8.1 enum field with filters

20134.2k](/packages/datomatic-nova-enum-field)[norman-huth/nova-assets-changer

Change Nova resources

2570.1k](/packages/norman-huth-nova-assets-changer)

PHPackages © 2026

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