PHPackages                             dillingham/nova-attach-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. [Utility &amp; Helpers](/categories/utility)
4. /
5. dillingham/nova-attach-many

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

dillingham/nova-attach-many
===========================

Attach Many Nova field

2.0.0(3y ago)2712.0M↓18.1%111[8 issues](https://github.com/dillingham/nova-attach-many/issues)[12 PRs](https://github.com/dillingham/nova-attach-many/pulls)2MITPHPPHP ^7.3|^8.0CI failing

Since Feb 2Pushed 2y ago7 watchersCompare

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

READMEChangelog (10)Dependencies (2)Versions (18)Used By (2)

Nova Attach Many
================

[](#nova-attach-many)

[![Latest Version on Github](https://camo.githubusercontent.com/48687df49cbf427989cbcf5213b9465a117cadc07001818637938564ce3a193a/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f72656c656173652f64696c6c696e6768616d2f6e6f76612d6174746163682d6d616e792e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/dillingham/nova-attach-many)[![Total Downloads](https://camo.githubusercontent.com/7221822911b13d5863a8cd6c7f6e8f7c701cbac096eafeb059e5c620906140d2/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f64696c6c696e6768616d2f6e6f76612d6174746163682d6d616e792e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/dillingham/nova-attach-many) [![Twitter Follow](https://camo.githubusercontent.com/4d611bda2f6e8730161339d887cbe17afe7f160bfde2eeb1baaf7cc40dd65071/68747470733a2f2f696d672e736869656c64732e696f2f747769747465722f666f6c6c6f772f696d5f627269616e5f643f636f6c6f723d253233316461316631266c6162656c3d54776974746572266c6f676f3d253233316461316631266c6f676f436f6c6f723d253233316461316631267374796c653d666c61742d737175617265)](https://twitter.com/im_brian_d)

Belongs To Many create &amp; edit form UI for Nova. Enables attaching relationships easily and includes validation.

[![attach-many](https://user-images.githubusercontent.com/29180903/52160651-be7fd580-2687-11e9-9ece-27332b3ce6bf.png)](https://user-images.githubusercontent.com/29180903/52160651-be7fd580-2687-11e9-9ece-27332b3ce6bf.png)

### Installation

[](#installation)

```
composer require dillingham/nova-attach-many
```

### Usage

[](#usage)

```
use NovaAttachMany\AttachMany;
```

```
public function fields(Request $request)
{
    return [
        AttachMany::make('Permissions'),
    ];
}
```

You can explicitly define the relationship &amp; Nova resource:

```
AttachMany::make('Field Name', 'relationshipName', RelatedResource::class);
```

### Display on detail:

[](#display-on-detail)

This package only provides the create / edit views that BelongsToMany does not.

BelongsToMany should be used for displaying the table on detail views.

```
public function fields(Request $request)
{
    return [
        AttachMany::make('Permissions'),
        BelongsToMany::make('Permissions'),
    ];
}
```

### Validation

[](#validation)

You can set min, max, size or custom rule objects

```
->rules('min:5', 'max:10', 'size:10', new CustomRule)
```

[![](https://user-images.githubusercontent.com/29180903/52160802-9ee9ac80-2689-11e9-9657-80e3c0d83b27.png)](https://user-images.githubusercontent.com/29180903/52160802-9ee9ac80-2689-11e9-9657-80e3c0d83b27.png)

### Options

[](#options)

Here are a few customization options

- `->showCounts()` Shows "selected/total"
- `->showPreview()` Shows only selected
- `->hideToolbar()` Removes search &amp; select all
- `->height('500px')` Set custom height
- `->fullWidth()` Set to full width
- `->showRefresh()` Request the resources again
- `->showSubtitle()` Show the resource's subtitle
- `->help('Tip: help text')` Set the help text

### All Options Demo

[](#all-options-demo)

[![](https://user-images.githubusercontent.com/29180903/53781117-6978ee80-3ed5-11e9-8da4-d2f2408f1ffb.png)](https://user-images.githubusercontent.com/29180903/53781117-6978ee80-3ed5-11e9-8da4-d2f2408f1ffb.png)

### Relatable

[](#relatable)

The attachable resources will be filtered by relatableQuery() So you can filter which resources are able to be attached

### Being Notified of Changes

[](#being-notified-of-changes)

You can add a method to the resource to be notified of the changes that have happened:

The method must be a camel cased version of the attribute name, followed by `Synced`. For example:

```
public function fields(Request $request)
{
    return [
        AttachMany::make('Permissions'),
    ];
}
```

```
public function permissionsSynced(array $changes)
{
    $changes['attached']; // An array of IDs of attached models
    $changes['detached']; // An array of IDs of detached models
    $changes['updated']; // An array of IDs of updated models
}
```

### Authorization

[](#authorization)

This field also respects policies: ie Role / Permission

- RolePolicy: attachAnyPermission($user, $role)
- RolePolicy: attachPermission($user, $role, $permission)
- PermissionPolicy: viewAny($user)

---

Author
======

[](#author)

Hi 👋, Im Brian D. I created this Nova package [and others](https://novapackages.com/collaborators/dillingham)

Hope you find it useful. Feel free to reach out with feedback.

Follow me on twitter: [@im\_brian\_d](https://twitter.com/im_brian_d)

###  Health Score

50

—

FairBetter than 96% of packages

Maintenance19

Infrequent updates — may be unmaintained

Popularity60

Solid adoption and visibility

Community31

Small or concentrated contributor base

Maturity74

Established project with proven stability

 Bus Factor2

2 contributors hold 50%+ of commits

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

Recently: every ~143 days

Total

17

Last Release

1393d ago

Major Versions

1.3.0 → 2.0.02022-07-25

PHP version history (2 changes)1.0PHP &gt;=7.1.0

2.0.0PHP ^7.3|^8.0

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/29180903?v=4)[Brian](/maintainers/dillingham)[@dillingham](https://github.com/dillingham)

---

Top Contributors

[![dillingham](https://avatars.githubusercontent.com/u/29180903?v=4)](https://github.com/dillingham "dillingham (31 commits)")[![alberto-bottarini](https://avatars.githubusercontent.com/u/1442934?v=4)](https://github.com/alberto-bottarini "alberto-bottarini (5 commits)")[![anditsung](https://avatars.githubusercontent.com/u/1090413?v=4)](https://github.com/anditsung "anditsung (5 commits)")[![ahmedkandel](https://avatars.githubusercontent.com/u/28398523?v=4)](https://github.com/ahmedkandel "ahmedkandel (4 commits)")[![drsdre](https://avatars.githubusercontent.com/u/809827?v=4)](https://github.com/drsdre "drsdre (4 commits)")[![niladam](https://avatars.githubusercontent.com/u/4151765?v=4)](https://github.com/niladam "niladam (3 commits)")[![bdelamatre](https://avatars.githubusercontent.com/u/3412927?v=4)](https://github.com/bdelamatre "bdelamatre (2 commits)")[![mbardelmeijer](https://avatars.githubusercontent.com/u/1583095?v=4)](https://github.com/mbardelmeijer "mbardelmeijer (2 commits)")[![vesper8](https://avatars.githubusercontent.com/u/816028?v=4)](https://github.com/vesper8 "vesper8 (1 commits)")[![briets](https://avatars.githubusercontent.com/u/5783618?v=4)](https://github.com/briets "briets (1 commits)")[![bsormagec](https://avatars.githubusercontent.com/u/965219?v=4)](https://github.com/bsormagec "bsormagec (1 commits)")[![GautierDele](https://avatars.githubusercontent.com/u/12382966?v=4)](https://github.com/GautierDele "GautierDele (1 commits)")[![jjjrmy](https://avatars.githubusercontent.com/u/1609800?v=4)](https://github.com/jjjrmy "jjjrmy (1 commits)")[![lptn](https://avatars.githubusercontent.com/u/150333538?v=4)](https://github.com/lptn "lptn (1 commits)")[![MPaap](https://avatars.githubusercontent.com/u/10021557?v=4)](https://github.com/MPaap "MPaap (1 commits)")[![mziraki](https://avatars.githubusercontent.com/u/6510195?v=4)](https://github.com/mziraki "mziraki (1 commits)")

---

Tags

laravellaravel-novalaravelnova

### Embed Badge

![Health badge](/badges/dillingham-nova-attach-many/health.svg)

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

###  Alternatives

[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)[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)[stepanenko3/nova-cards

A Laravel Nova info cards.

33143.0k](/packages/stepanenko3-nova-cards)

PHPackages © 2026

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