PHPackages                             lupennat/nova-expandable-many - 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. lupennat/nova-expandable-many

ActiveLibrary[Admin Panels](/categories/admin)

lupennat/nova-expandable-many
=============================

Laravel Nova - Expandable Many

v3.3.0(2y ago)440.4k↑172.2%6[2 issues](https://github.com/Lupennat/nova-expandable-many/issues)MITVuePHP ^7.4|^8.0CI passing

Since Dec 5Pushed 2y ago2 watchersCompare

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

READMEChangelogDependencies (2)Versions (25)Used By (0)

[![](https://github.com/Lupennat/nova-expandable-many/raw/main/demo.gif)](https://github.com/Lupennat/nova-expandable-many/blob/main/demo.gif)

1. [Requirements](#Requirements)
2. [Installation](#Installation)
3. [Usage](#Usage)
4. [Changelog](CHANGELOG.md)
5. [Credits](#Credits)

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

[](#requirements)

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

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

[](#installation)

```
composer require lupennat/nova-expandable-many:^3.0

```

NOVAPACKAGE&lt;4.29.51.x&lt;4.32.62.x&gt;=4.32.63.xUsage
-----

[](#usage)

Register Trait `HasExpandableMany` globally on Resources.

> the Trait include an override of `indexFields` method, it call method `withoutListableFieldsNotExpandable` instead of `withoutListableFields` on FieldCollection; if you already register a custom ovveride of `indexFields` you can do it manually without using provided trait.

ExpandableMany Package automatically enable a new method `expandable` for all Many Relationship Fields:

- BelongsToMany
- HasMany
- HasManyThrough
- MorphedByMany
- MorphMany
- MorphToMany

The relation table (without any custom actions and lenses) will be displayed as a collapsable row on the index page.

```
use Laravel\Nova\Fields\HasMany;
use Laravel\Nova\Http\Requests\NovaRequest;

class User extends Resource
{

   use Lupennat\ExpandableMany\HasExpandableMany;

    public function fields(Request $request)
    {
        return [
            HasMany::make('User Post', 'posts', Post::class)->expandable();
        ];
    }
}
```

By Default expandable use `Show` and `Hide` as labels, you can change labels using meta

```
    HasMany::make('User Post', 'posts', Post::class)->expandable()
        ->withMeta([
            'expandableShowLabel' => 'Custom Show',
            'expandableHideLabel' => 'Custom Hide',
        ])
```

you can also define a custom HTML using

```
    HasMany::make('User Post', 'posts', Post::class)->expandable()
        ->withMeta([
            'expandableShowHtml' => 'Custom Show Html',
            'expandableHideHtml' => 'Custom Hide Html',
        ])
```

> if both custom label and HTML are defined, HTML will be used

By Default expandable do not store on browser history any status, you can change it using meta

```
    HasMany::make('User Post', 'posts', Post::class)->expandable()
        ->withMeta([
            // 'expandableStoreStatus' => 'full', // will store status also for relationships
            'expandableStoreStatus' => 'accordion', // will store status only for accordion
            'expandableStoreStatus' => '', // will not store any status
        ])
```

Expandable can be skipped and an empty field is shown (by Default is false)

```
    HasMany::make('User Post', 'posts', Post::class)->expandable()
        ->withMeta([
            'expandableSkip' => true,
            'expandableSkipLabel' => '', // default is '—'
        ])
```

Expandable can disable standard actions (By Default is enabled)

```
    HasMany::make('User Post', 'posts', Post::class)->expandable()
        ->withMeta([
            'expandableUseStandardActions' => false, // disable create/edit/view/delete/restore
        ])
```

### Display Callback

[](#display-callback)

Expandable Many will resolve a display callback foreach resource, you can use it to manipulate meta attributes dinamically.

```
    HasMany::make('User Post', 'posts', Post::class)
        ->expandable(function(HasMany $field, $resource) {
            $resource->loadCount('posts');
            $field->withMeta([
                'expandableShowLabel' => 'Show ' . $resource->posts_count,
                'expandableSkip' => $resource->posts_count === 0
            ]);
        })
```

> By Default Expandable do not resolve relations, accessing a relationAttribute through the `$resource` will execute a query against database to load all related models.

### Lens

[](#lens)

If you want to use Expandable Many inside a Lens, you need to register also the trait `HasExpandableManyLens` inside your Lens.

```
use Laravel\Nova\Fields\HasMany;
use Laravel\Nova\Http\Requests\NovaRequest;
use Laravel\Nova\Lenses\Lens;

class UserLens extends Lens
{
   use Lupennat\ExpandableMany\HasExpandableManyLens;

    public function fields(Request $request)
    {
        return [
            HasMany::make('User Post', 'posts', Post::class)->expandable();
        ];
    }
}
```

Credits
-------

[](#credits)

This package is based on the original idea from [Nova Expandable Row](https://github.com/SPRIGS/nova-expandable-row)

###  Health Score

32

—

LowBetter than 72% of packages

Maintenance10

Infrequent updates — may be unmaintained

Popularity35

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity57

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

Recently: every ~14 days

Total

22

Last Release

797d ago

Major Versions

v2.0.1 → v3.0.02023-12-10

v1.1.3 → v3.1.02024-01-11

v1.2.0 → v3.2.02024-01-17

v1.3.0 → v2.2.02024-01-17

v1.4.0 → v3.3.02024-03-12

### 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 (40 commits)")

---

Tags

laravelnova

###  Code Quality

Code StylePHP CS Fixer

### Embed Badge

![Health badge](/badges/lupennat-nova-expandable-many/health.svg)

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

###  Alternatives

[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)[harrald/nova-combobox-filter

A Laravel Nova combobox filter. Supports selecting multiple items

13105.5k](/packages/harrald-nova-combobox-filter)[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)
