PHPackages                             nevadskiy/nova-collection-field - 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. nevadskiy/nova-collection-field

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

nevadskiy/nova-collection-field
===============================

Collection fields for Laravel Nova.

0.3.0(2y ago)087MITPHPPHP ^8.0

Since Oct 6Pushed 2y ago1 watchersCompare

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

READMEChangelog (5)DependenciesVersions (7)Used By (0)

Collection fields for Laravel Nova
==================================

[](#collection-fields-for-laravel-nova)

Usage
-----

[](#usage)

### HasManyCollection

[](#hasmanycollection)

FaqSection resource:

```
namespace App\Nova;

use App\Models\FaqSection as FaqSectionModel;
use App\Nova\Resource;
use Laravel\Nova\Fields\ID;
use Laravel\Nova\Fields\Text;
use Laravel\Nova\Http\Requests\NovaRequest;
use Nevadskiy\Nova\Collection\HasManyCollection;

class FaqSection extends Resource
{
    public static string $model = FaqSectionModel::class;

    public static $title = 'heading';

    public static $search = [
        'heading',
    ];

    public function fields(NovaRequest $request): array
    {
        return [
            ID::make(),

            Text::make('Heading'),

            HasManyCollection::make('Questions', 'items', FaqItem::class)
                ->sortBy('position')
                ->stacked()
                ->fullWidth()
        ];
    }
}
```

FaqSection model:

```
namespace App\Models;

use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\HasMany;

class FaqSection extends Model
{
    public function items(): HasMany
    {
        return $this->hasMany(FaqItem::class);
    }
}
```

### MorphToManyCollection

[](#morphtomanycollection)

Usage example for a `Page` model that has defined [Many-To-Many (Polymorphic)](https://laravel.com/docs/eloquent-relationships#many-to-many-polymorphic-relations) relations.

Page resource:

```
namespace App\Nova;

use App\Models\Page as PageModel;
use Laravel\Nova\Fields\ID;
use Laravel\Nova\Fields\Text;
use Laravel\Nova\Http\Requests\NovaRequest;
use Nevadskiy\Nova\Collection\MorphToManyCollection;

class Page extends Resource
{
    public static string $model = PageModel::class;

    public function fields(NovaRequest $request): array
    {
        return [
            ID::make(),

            Text::make('Title'),

            MorphToManyCollection::make('Components')
                ->resources([
                    'heroSections' => HeroSection::class,
                    'demoSections' => DemoSection::class,
                    'faqSections' => FaqSection::class,
                ])
                ->sortBy('position')
                ->attachable()
                ->collapsable()
                ->stacked()
                ->fullWidth(),
        ];
    }
}
```

Page model:

```
namespace App\Models;

use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\MorphToMany;

class Page extends Model
{
    public function heroSections(): MorphToMany
    {
        return $this->morphedByMany(HeroSection::class, 'page_component')
            ->withPivot('position');
    }

    public function demoSections(): MorphToMany
    {
        return $this->morphedByMany(DemoSection::class, 'page_component')
            ->withPivot('position');
    }

    public function faqSections(): MorphToMany
    {
        return $this->morphedByMany(FaqSection::class, 'page_component')
            ->withPivot('position');
    }
}
```

### ManyToMorphCollection

[](#manytomorphcollection)

If you do not want to define a separate relation for each model type, you can use `ManyToMorphCollection` field that requires a separate [ManyToMorph](https://github.com/nevadskiy/laravel-many-to-morph) relation.

Usage example for a `Page` model that has defined the Many-To-Morph relation.

Page resource:

```
namespace App\Nova;

use App\Models\Page as PageModel;
use Laravel\Nova\Fields\ID;
use Laravel\Nova\Fields\Text;
use Laravel\Nova\Http\Requests\NovaRequest;
use Nevadskiy\Nova\Collection\MorphToManyCollection;

class Page extends Resource
{
    public static string $model = PageModel::class;

    public function fields(NovaRequest $request): array
    {
        return [
            ID::make(),

            Text::make('Title'),

            ManyToMorphCollection::make('Components')
                ->resources([
                    HeroSection::class,
                    DemoSection::class,
                    FaqSection::class,
                ])
                ->sortBy('position')
                ->attachable()
                ->collapsable()
                ->stacked()
                ->fullWidth(),
        ];
    }
}
```

`Page` model:

```
namespace App\Models;

use Illuminate\Database\Eloquent\Model;
use Nevadskiy\ManyToMorph\HasManyToMorph;
use Nevadskiy\ManyToMorph\ManyToMorph;

class Page extends Model
{
    use HasManyToMorph;

    public function components(): ManyToMorph
    {
        return $this->manyToMorph('page_component');
    }
}
```

To-Do List
----------

[](#to-do-list)

- validation
- detail view
- delete with detach when is not used attachable mode

###  Health Score

21

—

LowBetter than 19% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity9

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity42

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

Total

5

Last Release

886d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/28da65e8fb67327a4aecc884be2d4d14d719ed0b393ec9c4febe0f91b9750eb5?d=identicon)[xalaida](/maintainers/xalaida)

---

Top Contributors

[![xalaida](https://avatars.githubusercontent.com/u/31131784?v=4)](https://github.com/xalaida "xalaida (40 commits)")

---

Tags

laravelcollectionfieldnovaMorph to many

### Embed Badge

![Health badge](/badges/nevadskiy-nova-collection-field/health.svg)

```
[![Health](https://phpackages.com/badges/nevadskiy-nova-collection-field/health.svg)](https://phpackages.com/packages/nevadskiy-nova-collection-field)
```

###  Alternatives

[timothyasp/nova-color-field

A Laravel Nova Color Picker field.

781.6M5](/packages/timothyasp-nova-color-field)[armincms/json

A Laravel Nova field.

25149.4k3](/packages/armincms-json)[alexwenzel/nova-dependency-container

A Laravel Nova 4 form container for grouping fields that depend on other field values.

461.0M2](/packages/alexwenzel-nova-dependency-container)[simplesquid/nova-enum-field

A Laravel Nova field to add enums to resources.

52391.9k2](/packages/simplesquid-nova-enum-field)[outhebox/nova-hidden-field

A Laravel Nova Hidden field.

33562.2k1](/packages/outhebox-nova-hidden-field)[sietse85/nova-button

(Nova 4+) A Laravel Nova package for adding buttons to your resources.

37347.3k](/packages/sietse85-nova-button)

PHPackages © 2026

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