PHPackages                             chiwex/nova-nested-form - 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. chiwex/nova-nested-form

ActiveLibrary[Admin Panels](/categories/admin)

chiwex/nova-nested-form
=======================

A Laravel Nova package that allows you to create/update/delete nested related fields from a parent form.

v3.0.11(5y ago)07MITPHPPHP &gt;=7.1.0

Since Oct 29Pushed 5y agoCompare

[ Source](https://github.com/chiwex/laravel-nova-nested-form)[ Packagist](https://packagist.org/packages/chiwex/nova-nested-form)[ RSS](/packages/chiwex-nova-nested-form/feed)WikiDiscussions master Synced today

READMEChangelogDependencies (1)Versions (32)Used By (0)

[![Latest Stable Version](https://camo.githubusercontent.com/163cdd81dbfa56eacb6d1d307a6b2c1e00a8261803d75f743c1dfee8d36d39e1/68747470733a2f2f706f7365722e707567782e6f72672f79617373692f6e6f76612d6e65737465642d666f726d2f762f737461626c65)](https://packagist.org/packages/yassi/nova-nested-form) [![Total Downloads](https://camo.githubusercontent.com/c4ce3dea4d57838829bc07a0b2767ed78dd6394855c1c256fb16afe2cce219b7/68747470733a2f2f706f7365722e707567782e6f72672f79617373692f6e6f76612d6e65737465642d666f726d2f646f776e6c6f616473)](https://packagist.org/packages/yassi/nova-nested-form) [![Latest Unstable Version](https://camo.githubusercontent.com/f799cabf793a0e47d82e5f3cb94e8a0cb1be4e6f4c7aed14c8f325c7c49eaba5/68747470733a2f2f706f7365722e707567782e6f72672f79617373692f6e6f76612d6e65737465642d666f726d2f762f756e737461626c65)](https://packagist.org/packages/yassi/nova-nested-form) [![License](https://camo.githubusercontent.com/4dfba9e1d40c27d8435360dde61b3b142d4d9461e173b44486126ffa9777081e/68747470733a2f2f706f7365722e707567782e6f72672f79617373692f6e6f76612d6e65737465642d666f726d2f6c6963656e7365)](https://packagist.org/packages/yassi/nova-nested-form) [![Monthly Downloads](https://camo.githubusercontent.com/70ea6857c2ff0a866b0cd4811414cc556c7e8865d403facbe45386479b4c15ff/68747470733a2f2f706f7365722e707567782e6f72672f79617373692f6e6f76612d6e65737465642d666f726d2f642f6d6f6e74686c79)](https://packagist.org/packages/yassi/nova-nested-form) [![Daily Downloads](https://camo.githubusercontent.com/f68f3e93ee15e469ade20ff4ccd2ab27942a3daecec6f549ddd06f4708616fd9/68747470733a2f2f706f7365722e707567782e6f72672f79617373692f6e6f76612d6e65737465642d666f726d2f642f6461696c79)](https://packagist.org/packages/yassi/nova-nested-form)

Nova Nested Form
================

[](#nova-nested-form)

This package allows you to include your nested relationships' forms into a parent form.

Installation
============

[](#installation)

```
composer require yassi/nova-nested-form
```

Contributions
=============

[](#contributions)

As I did not anticipate so many people would use that package (which is awesome) and simply do not have enough time to update/enhance this package more regularly on my own, I am looking for other contributors to help me with the maintenance and feature requests. Don't hesitate to contact me if you're interested!

Update to 3.0
=============

[](#update-to-30)

The **afterFill** and **beforeFill** methods are no longer available.

Attach a new relationship form to a resource
============================================

[](#attach-a-new-relationship-form-to-a-resource)

Simply add a NestedForm into your fields. The first parameter must be an existing NovaResource class and the second parameter (optional) must be an existing HasOneOrMany relationship in your model.

```
namespace App\Nova;

use Laravel\Nova\Fields\ID;
use Illuminate\Http\Request;
use Laravel\Nova\Fields\Text;
use Laravel\Nova\Fields\Gravatar;
use Laravel\Nova\Fields\Password;
// Add use statement here.
use Yassi\NestedForm\NestedForm;

class User extends Resource
{
    ...
    public function fields(Request $request)
    {
        return [
            ID::make()->sortable(),

            Gravatar::make(),

            Text::make('Name')
                ->sortable()
                ->rules('required', 'max:255'),

            Text::make('Email')
                ->sortable()
                ->rules('required', 'email', 'max:254')
                ->creationRules('unique:users,email')
                ->updateRules('unique:users,email,{{resourceId}}'),

            Password::make('Password')
                ->onlyOnForms()
                ->creationRules('required', 'string', 'min:6')
                ->updateRules('nullable', 'string', 'min:6'),

            // Add NestedForm here.
            NestedForm::make('Posts'),
        ];
    }
```

Choose when to display the form
===============================

[](#choose-when-to-display-the-form)

For instance, if the nested form should only be available if the value of the "has\_comments" attirbute is true, you can use:

```
class Post extends Resource
{
    ...
    public function fields(Request $request)
    {
        return [
            Boolean::make('Has Comments'),
            NestedForm::make('Comments')->displayIf(function ($nestedForm, $request) {
               return [
                    [ 'attribute' => 'has_comments', 'is' => true ]
               ];
        ];
    }
})
```

The **displayIf** method is excepted to return an array of array as you may want to add several conditions.

```
class Post extends Resource
{
    ...
    public function fields(Request $request)
    {
        return [
            Boolean::make('Has Comments'),
            Text::make('Title'),
            Text::make('Subtitle')->nullable(),
            Number::make('Number of comments allowed'),
            NestedForm::make('Comments')->displayIf(function ($nestedForm, $request) {
                return [
                    [ 'attribute' => 'has_comments', 'is' => true ],
                    [ 'attribute' => 'title', 'isNotNull' => true ],
                    [ 'attribute' => 'subtitle', 'isNull' => true ],
                    [ 'attribute' => 'title', 'includes' => 'My' ],
                    [ 'attribute' => 'number_of_comments_allowed', 'moreThanOrEqual' => 1 ],
                ];
            })
        ];
    }
}
```

The package will then add those conditions and dynamically update your form as you fill the fields. The available rules are:

- is
- isNot
- isNull
- isNotNull
- isMoreThan
- isMoreThanOrEqual
- isLessThan
- isLessThanOrEqual

Add a minimum or a maximum number of children
=============================================

[](#add-a-minimum-or-a-maximum-number-of-children)

For instance, if you want every user to have at least 3 posts and at most 5 posts, simply use:

```
NestedForm::make('Posts')->min(3)->max(5),
```

Please note that the package automatically detects whether the relationship excepts many children or a single child, and sets the maximum value accordingly.

When creating a new user, 3 blank posts will be displayed. If you reach the maximum number of posts, the "Add a new post" button will disappear.

Set the default open/collapse behavior
======================================

[](#set-the-default-opencollapse-behavior)

If you want the nested forms to be opened by default, simply use:

```
NestedForm::make('Posts')->open(true),
```

Modify the default heading
==========================

[](#modify-the-default-heading)

You can modify the default heading using the heading() method. You can use the helper method **wrapIndex()** to add the current child index to your header.

```
NestedForm::make('Posts')->heading(NestedForm::wrapIndex() . ' // Post'),
```

You can also add any attribute of the current child into your heading using the helper method **wrapAttribute()**.

```
NestedForm::make('Posts')->heading(NestedForm::wrapIndex() . ' // ' . NestedForm::wrapAttribute('title', 'My default title')),
```

Modify the index separator
==========================

[](#modify-the-index-separator)

You can modify the default index separator using the separator() method when you have nested forms (e.g. 1. Post, 1.1. Comment, 1.1.1. Like).

```
NestedForm::make('Posts')->separator('\'),

```

###  Health Score

29

—

LowBetter than 60% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity4

Limited adoption so far

Community16

Small or concentrated contributor base

Maturity67

Established project with proven stability

 Bus Factor1

Top contributor holds 53.9% 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 ~33 days

Recently: every ~86 days

Total

26

Last Release

1903d ago

Major Versions

v1.0.4 → v2.0.02018-12-01

v2.1.0 → 3.0.0.x-dev2019-05-18

### Community

Maintainers

![](https://www.gravatar.com/avatar/82de017fec50c9c2bc5ff30933457f99fbcb99fa66c25aad549f526158919ced?d=identicon)[chiwex](/maintainers/chiwex)

---

Top Contributors

[![yassilah](https://avatars.githubusercontent.com/u/13403295?v=4)](https://github.com/yassilah "yassilah (55 commits)")[![duckzland](https://avatars.githubusercontent.com/u/1064954?v=4)](https://github.com/duckzland "duckzland (12 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (8 commits)")[![alberto-bottarini](https://avatars.githubusercontent.com/u/1442934?v=4)](https://github.com/alberto-bottarini "alberto-bottarini (7 commits)")[![303K](https://avatars.githubusercontent.com/u/3934941?v=4)](https://github.com/303K "303K (4 commits)")[![jangidgirish](https://avatars.githubusercontent.com/u/4018017?v=4)](https://github.com/jangidgirish "jangidgirish (4 commits)")[![joseballester](https://avatars.githubusercontent.com/u/12814091?v=4)](https://github.com/joseballester "joseballester (2 commits)")[![andriiPalko](https://avatars.githubusercontent.com/u/21694348?v=4)](https://github.com/andriiPalko "andriiPalko (2 commits)")[![techbly](https://avatars.githubusercontent.com/u/7074565?v=4)](https://github.com/techbly "techbly (2 commits)")[![MaxKorlaar](https://avatars.githubusercontent.com/u/8917249?v=4)](https://github.com/MaxKorlaar "MaxKorlaar (1 commits)")[![ThibaudDauce](https://avatars.githubusercontent.com/u/1770543?v=4)](https://github.com/ThibaudDauce "ThibaudDauce (1 commits)")[![gazben](https://avatars.githubusercontent.com/u/3780285?v=4)](https://github.com/gazben "gazben (1 commits)")[![atmonshi](https://avatars.githubusercontent.com/u/1952412?v=4)](https://github.com/atmonshi "atmonshi (1 commits)")[![zippoxer](https://avatars.githubusercontent.com/u/859015?v=4)](https://github.com/zippoxer "zippoxer (1 commits)")[![jeffreydevreede](https://avatars.githubusercontent.com/u/2203546?v=4)](https://github.com/jeffreydevreede "jeffreydevreede (1 commits)")

---

Tags

laravelnestedformnovarelationship

### Embed Badge

![Health badge](/badges/chiwex-nova-nested-form/health.svg)

```
[![Health](https://phpackages.com/badges/chiwex-nova-nested-form/health.svg)](https://phpackages.com/packages/chiwex-nova-nested-form)
```

###  Alternatives

[yassi/nova-nested-form

A Laravel Nova package that allows you to create/update/delete nested related fields from a parent form.

239501.6k](/packages/yassi-nova-nested-form)[handleglobal/nova-nested-form

A Laravel Nova package that allows you to create/update/delete nested related fields from a parent form.

391.8k](/packages/handleglobal-nova-nested-form)[khalin/nova-link-field

A Laravel Nova Link field.

31562.2k2](/packages/khalin-nova-link-field)[printnow/laravel-admin

Dcat admin 永久分叉版 / 支持 Laravel 12, PHP 版本限制 &gt;= 8.1（支持 PHP 8.4）

432.0k](/packages/printnow-laravel-admin)

PHPackages © 2026

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