PHPackages                             formfeed-uk/nova-dependable-panel - 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. formfeed-uk/nova-dependable-panel

ActiveLibrary[Admin Panels](/categories/admin)

formfeed-uk/nova-dependable-panel
=================================

A Laravel Nova Field acting as a Panel for grouped dependsOn functionality

1.2.3(3y ago)790.4k↑12.3%9[3 PRs](https://github.com/Formfeed-UK/nova-dependable-panel/pulls)MITPHPPHP ^7.3|^8.0

Since Oct 7Pushed 1y ago1 watchersCompare

[ Source](https://github.com/Formfeed-UK/nova-dependable-panel)[ Packagist](https://packagist.org/packages/formfeed-uk/nova-dependable-panel)[ RSS](/packages/formfeed-uk-nova-dependable-panel/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (10)Dependencies (3)Versions (14)Used By (0)

Nova 4 Dependable Panel
=======================

[](#nova-4-dependable-panel)

This [Laravel Nova](https://nova.laravel.com/) package adds Panels that allow grouped dependsOn functionality

Dusk Test Repo:

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

[](#requirements)

- `php: ^7.3|^8.0`
- `laravel/nova: ^4.0`

Features
--------

[](#features)

- Grouping all dependsOn requests for fields within this panel into one request
- Hiding/Showing the entire Panel based on a dependsOn function
- Changing the Fields within the Panel as a result of a dependsOn function
- Making a batched dependsOn function for all fields within the panel, (overidden at the Field Level)
- Works with Nova Tabs
- Works with the fork of Nova Flexible Content allowing for dependsOn fields within Layout Groups
- Fields can be added to an existing panel or seperated into a new one

Note that this package is an extension of a Field, rather than a Panel, however it can act as a panel when the `separatePanel` method is used. This is to allow more flexibility to use fields as part of an existing Panel.

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

[](#installation)

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

```
composer require formfeed-uk/nova-dependable-panel
```

Usage
-----

[](#usage)

### Basic Usage

[](#basic-usage)

#### Hiding the entire Panel based on a dependsOn function

[](#hiding-the-entire-panel-based-on-a-dependson-function)

```
    use FormFeed\DependablePanel\DependablePanel;

    public function fields(NovaRequest $request)
    {
        return [
            Select::make('Select', 'select')->options([
                'option1' => 'Option 1',
                'option2' => 'Option 2',
            ]),
            DependablePanel::make('Panel Title', [
                Text::make('Field 1'),
                Text::make('Field 2'),
            ])
            ->dependsOn(["select"], function (DependablePanel $panel, NovaRequest $request, FormData $formData) {
                if ($formData['select'] == "option1") {
                    $panel->hide();
                }
            }),
        ];
    }
```

#### Single dependsOn request for all fields within the panel

[](#single-dependson-request-for-all-fields-within-the-panel)

All of the Text Fields dependsOn requests will be sent as one request using the `singleRequest` method. This is useful for both reducing the number of requests on large forms and for more consistent UX as the fields are changed at the same time.

```
    use FormFeed\DependablePanel\DependablePanel;

    public function fields(NovaRequest $request)
    {
        return [
            DependablePanel::make('Panel Title', [
                Select::make('Select', 'select')->options([
                    'option1' => 'Option 1',
                    'option2' => 'Option 2',
                ]),
                Text::make('Hide Field 1')
                    ->dependsOn(["select"], function (Text $field, NovaRequest $request, FormData $formData) {
                        if ($formData['select'] == "option1") {
                            $field->hide();
                        }
                    }),
                Text::make('Hide Field 2')
                    ->dependsOn(["select"], function (Text $field, NovaRequest $request, FormData $formData) {
                        if ($formData['select'] == "option1") {
                            $field->hide();
                        }
                    }),
                Text::make('Show Field 3')
                    ->hide()
                    ->dependsOn(["select"], function (Text $field, NovaRequest $request, FormData $formData) {
                        if ($formData['select'] == "option1") {
                            $field->show();
                        }
                    }),
                Text::make('Show Field 4')
                    ->hide()
                    ->dependsOn(["select"], function (Text $field, NovaRequest $request, FormData $formData) {
                        if ($formData['select'] == "option1") {
                            $field->show();
                        }
                    }),
            ])
            ->singleRequest(true);
        ];
    }
```

#### Batching dependsOn functionality for all contained fields

[](#batching-dependson-functionality-for-all-contained-fields)

You can also batch dependsOn functionality for all fields within your Panel using the `applyToFields` method. For example if you need all fields to become readOnly. This can be overidden at the Field Level.

Note that the first parameter should be of type `Field` to ensure that the function can apply to all fields within your panel, regardless of type.

```
    use FormFeed\DependablePanel\DependablePanel;

    public function fields(NovaRequest $request)
    {
        return [
            DependablePanel::make('Panel Title', [
                Select::make('Select', 'select')->options([
                    'option1' => 'Option 1',
                    'option2' => 'Option 2',
                ]),
                Text::make('Field 1'),
                Text::make('Field 2'),
                Text::make('Field 3')
                ->dependsOn(['select'], function (Text $field, NovaRequest $request, FormData $formData) {
                    if ($formData['select'] == "option1") {
                        $field->readOnly(false);
                    }
                })
            ])
            ->dependsOn(["select"], function (DependablePanel $panel, NovaRequest $request, FormData $formData) {
                $panel->applyToFields(function (Field $field, NovaRequest $request, FormData $formData) {
                    if ($formData['select'] == "option1") {
                        $field->readOnly();
                    }
                });
            }),
        ];
    }
```

#### Separating the Panel

[](#separating-the-panel)

The fields in Nova Dependable Panel can be part of any other panel (default), or can be separated into another panel using the `separatePanel` method.

This panel will use the first argument to DependablePanel as its panel name.

```
    use FormFeed\DependablePanel\DependablePanel;

    public function fields(NovaRequest $request)
    {
        return [
            DependablePanel::make('Panel Title', [
                Select::make('Select', 'select')->options([
                    'option1' => 'Option 1',
                    'option2' => 'Option 2',
                ]),
                Text::make('Field 1'),
                Text::make('Field 2'),
                Text::make('Field 3')
            ])
            ->separatePanel(true)
        ];
    }
```

#### Changing the fields in the Panel as a result of dependsOn

[](#changing-the-fields-in-the-panel-as-a-result-of-dependson)

Rather than hiding/showing fields as a result of dependsOn, you can change the fields themselves using the `fields` method. Note that this functionality requires `singleRequest` to operate properly.

```
    use FormFeed\DependablePanel\DependablePanel;

    public function fields(NovaRequest $request)
    {
        return [
            Select::make('Select', 'select')->options([
                'option1' => 'Option 1',
                'option2' => 'Option 2',
            ]),
            DependablePanel::make('Panel Title', [
                Text::make('Field 1'),
                Text::make('Field 2'),
            ])
            ->singleRequest(true)
            ->dependsOn(["select"], function (DependablePanel $panel, NovaRequest $request, FormData $formData) {
                if ($formData['select'] == "option1") {
                    $panel->fields([
                        Text::make('Field 3'),
                        Text::make('Field 4'),
                    ]);
                }
            }),
        ];
    }
```

**Note: If the fields added via the `fields` method also have dependsOn defined, and you wish those dependsOn mixins to be applied correctly when those fields are first mounted, you should include the fields that they depend upon in the panels `dependsOn` function.**

In the example below if the "Readonly" checkbox is checked, and then the select option is changed to Option 1, in order for these fields to be readonly when mounted, you can see "readonly" needs to be included in the panels `dependsOn` function.

```
    use FormFeed\DependablePanel\DependablePanel;

    public function fields(NovaRequest $request)
    {
        return [
            Select::make('Select', 'select')->options([
                'option1' => 'Option 1',
                'option2' => 'Option 2',
            ]),
            Boolean::make('Readonly'),
            DependablePanel::make('Panel Title', [
                Text::make('Field 1'),
                Text::make('Field 2'),
            ])
            ->singleRequest(true)
            ->dependsOn(["select", "readonly"], function (DependablePanel $panel, NovaRequest $request, FormData $formData) {
                if ($formData['select'] == "option1") {
                    $panel->fields([
                        Text::make('Field 3')
                            ->dependsOn(["readonly"], function (Text $field, NovaRequest $request, FormData $formData) {
                                if ($formData['readonly']) {
                                    $field->readonly();
                                }
                            }),
                        Text::make('Field 4')
                            ->dependsOn(["readonly"], function (Text $field, NovaRequest $request, FormData $formData) {
                                if ($formData['readonly']) {
                                    $field->readonly();
                                }
                            }),
                    ]);
                }
            }),
        ];
    }
```

Known Issues
------------

[](#known-issues)

- Panels cannot be seperated/combined in the dependsOn function, this can only be set once upon page load
- When swapping between different sets of fields via the `Fields` method in the Panels `dependsOn` changed values will not persist on the update form for fields where values are already stored in the database for that resource.
- Nova's Boolean field doesn't behave as expected due to its value being set to false when it is null, this means that Boolean fields altered by the dependable panel will be false, which isn't great UX. A middleware fix is incoming, but for now it's recommended to extend the Boolean field within your project and perform the following override:

```
    protected function resolveDefaultValue(NovaRequest $request)
    {
        return Field::resolveDefaultValue($request);
    }
```

License
-------

[](#license)

Nova Dependable Panel is open-sourced software licensed under the [MIT license](LICENSE.md).

###  Health Score

38

—

LowBetter than 85% of packages

Maintenance28

Infrequent updates — may be unmaintained

Popularity39

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity59

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

Total

12

Last Release

1230d ago

Major Versions

0.1.4 → 1.0.02022-10-31

### Community

Maintainers

![](https://www.gravatar.com/avatar/6116a0834c68177c53e80259399de5ad6cbfc8e49e2c945343f1cacf8accd14a?d=identicon)[ianrobertsFF](/maintainers/ianrobertsFF)

---

Top Contributors

[![ianrobertsFF](https://avatars.githubusercontent.com/u/91917328?v=4)](https://github.com/ianrobertsFF "ianrobertsFF (63 commits)")

---

Tags

laravelnovapaneldependsOn

### Embed Badge

![Health badge](/badges/formfeed-uk-nova-dependable-panel/health.svg)

```
[![Health](https://phpackages.com/badges/formfeed-uk-nova-dependable-panel/health.svg)](https://phpackages.com/packages/formfeed-uk-nova-dependable-panel)
```

###  Alternatives

[outl1ne/nova-table-field

Table field for Laravel Nova

4057.9k](/packages/outl1ne-nova-table-field)[khalin/nova-link-field

A Laravel Nova Link field.

31562.2k2](/packages/khalin-nova-link-field)[digital-creative/nova-dashboard

The missing dashboard for nova.

7169.3k1](/packages/digital-creative-nova-dashboard)[marianvlad/nova-ssl-card

A Laravel Nova card for SSL certificates.

1219.9k](/packages/marianvlad-nova-ssl-card)

PHPackages © 2026

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