Weave Code
Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message
Many To Many

Many To Many Laravel Package

armincms/many-to-many

A Laravel package that extends Eloquent many-to-many relationships with helpers for attaching, detaching, and managing related models through pivot tables. It aims to simplify common relationship workflows and offer a cleaner API for complex many-to-many handling.

View on GitHub
Deep Wiki
Context7

ArminCMS Many-to-Many offers a fluent, Eloquent-friendly way to manage complex many-to-many relationships in Laravel applications. It streamlines attaching, detaching, and syncing related models while handling pivot data and custom pivot models with minimal boilerplate.

  • Intuitive API for attaching, detaching, and syncing relations
  • Full support for pivot attributes and custom pivot models
  • Seamless integration with Eloquent and Laravel Nova
  • Query scopes for filtering records through pivot tables
  • Lightweight, dependency-free, and easy to extend
Frequently asked questions about Many To Many
Is armincms/many-to-many a general Eloquent helper or a Laravel Nova field?
Despite the Eloquent-flavoured description, it is a Laravel Nova field that extends Nova's field base class and registers Vue components through a service provider. You use it by returning ManyToMany::make('Tags') from a Nova resource's fields() method, where it renders a searchable multi-select transfer UI mapped to an existing BelongsToMany relationship. That makes it useful only if your application already runs Laravel Nova; in a plain Laravel app or on a customer-facing surface it does nothing. Evaluate it as a Nova field, not as a replacement for Eloquent's attach, detach, and sync methods.
How do I install armincms/many-to-many and what are the requirements?
Installation is a standard Composer require followed by whatever service provider and asset publishing the package documents, since Nova fields ship compiled Vue assets. Before committing, read the laravel/nova, laravel/framework, and php constraints in its composer.json and confirm they match your stack. The last tagged release is February 2023, so treat the version constraints as the first thing to verify rather than assuming current Nova compatibility. A hard constraint here can block an admin-panel-wide Nova upgrade, not just the resources using the field.
Does armincms/many-to-many support Laravel Nova 5?
That is unconfirmed and is the dominant technical risk. The most recent release is from February 2023, which places it in the Nova 4 era, and Nova 3 to 4 to 5 changed front-end internals materially. Front-end incompatibilities show up visually rather than in logs: the field renders blank and nothing appears in storage/logs/laravel.log. Run a time-boxed spike on your actual Nova version before adopting it anywhere important.
How does the package persist pivot attributes?
Pivot data is declared twice: the UI fields you configure on the Nova field must be mirrored in the withPivot() call on the underlying Eloquent relationship. If the two lists diverge, values fail to persist silently rather than throwing an error. This is a correctness trap rather than a build trap, so write a round-trip test on a fresh install that saves a pivot row and reads it back. Also confirm whether the field eager-loads pivot attributes or whether you need a resource-level mitigation such as pivot() on the relationship.
Do I still need to define the Eloquent relationship before using this field?
Yes. The Eloquent relationship is the contract and the field is only the UI layer on top of it, so define the belongsToMany method first and get the pivot table right. The attribute name passed to ManyToMany::make() must match the relationship method name exactly. Keeping the native Nova BelongsToMany field nearby as a documented one-line fallback makes rollback a simple field swap.
How is this different from Nova's built-in BelongsToMany field?
The delta is richer inline pivot editing, creating related records on the fly, configurable labels and search, and a searchable multi-select transfer UI. If native Nova or a field package already in your stack covers those needs, the business case for adding this dependency collapses. Compare against your current field set on one real resource before expanding usage.
What is a sensible first use case for this Laravel package?
Tagging is the right first use case on a single low-risk Nova resource with simple pivot columns such as order, weight, assigned-at, or a role label. Roles and permissions are the wrong first case, because detaching the wrong record has authorization consequences. Explicit non-fits include audit trails, approvals, bulk operations, import/export, granular permissions, and membership history. Adopt it field by field at the resource level and record in your repository which resources use it.
Does armincms/many-to-many support morphToMany relationships?
Morph support is unverified, and the documentation does not establish parity with Eloquent's morphToMany. Assume you may need a custom field or a fallback to native Nova for polymorphic relations. Test a polymorphic relationship explicitly during the spike rather than discovering the gap in production.
How does it perform with thousands of related records?
That depends on whether server-side search and pagination are implemented, which is unverified, so test with production-scale record counts rather than ten fixtures. The failure mode is render latency in the selector, not database cost, so watch front-end responsiveness as the related set grows. Confirm the fluent methods and extension points that actually exist in src/ instead of assuming BelongsToMany parity.
Is armincms/many-to-many actively maintained, and can I remove it later?
Expect to own a fork: it has roughly 25 stars, zero dependents, a single maintainer, and no commercial backing, with the latest release in February 2023. Also watch for global Vue component-name collisions with other installed Nova field packages. Removal is cheap by design because rollback is a field swap back to Nova's native BelongsToMany, which is exactly why a one-engineer-day pilot is reasonable to authorize.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
robertmarney/lara-hierarchial-collections
simonschaufi/rule-doc-generator
emissaoja/emissaoja
blackbricksoftware/gravityforms-civicrm-form-processor
al-rahabi/fancy-crud
jinas/dhivatar-component
mltstephane/laravel-quality
bernskiold/laravel-talentlms
bernskioldmedia/laravel-form-architect
youbar/easy-crud
c-point-labs/laravel-hostyourai
dbravoan/dbcms-admin-theme-dbcms
dbravoan/dbcms-theme-db-cyber
dbravoan/dbcms-blocks-basic
dbravoan/dbcms-module-content-audit
dbravoan/dbcms-module-ai-assistant
paygate-to/paygate-php
padosoft/askmydocs-connector-base
defstudio/supercharged-carbon
bernskioldmedia/laravel-matomo