Weave Code
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
Nova Multiselect Field

Nova Multiselect Field Laravel Package

outl1ne/nova-multiselect-field

View on GitHub
Deep Wiki
Context7

A Laravel Nova package that adds a multiselect to Nova's arsenal of fields.

Frequently asked questions about Nova Multiselect Field
How do I replace a standard Nova Select field with a multiselect in my resource?
Replace `Select::make('Field')` with `Multiselect::make('Field')` in your resource’s `fields()` method. For example, swap `Select::make('Tags')->options($tags)` to `Multiselect::make('Tags')->asyncResource(Tag::class)`. The package mimics Nova’s native field syntax for seamless integration.
Does this package support Laravel Nova 4.x or 3.x?
Yes, the package supports Nova 5.x by default, but you can use specific branches for Nova 4.x (`nova-v4`) or 3.x (`nova-v3`). Check the repository’s ‘Other Versions’ section for installation instructions tailored to your Nova version.
What database column type should I use for multiselect fields?
Use `string`, `text`, or `varchar` for text-based storage (default). If your database supports JSON (PostgreSQL/MySQL 5.7+), enable `saveAsJSON()` in the field configuration to store values as JSON arrays. This requires no schema changes for existing text columns.
How do I load options asynchronously for large datasets?
Use the `asyncResource()` method to dynamically fetch options from an Eloquent model, e.g., `->asyncResource(Artist::class)`. For custom endpoints, pass a URL via `->api('/custom-endpoint')`. Async queries reduce frontend load times but add network latency—test with `optionsLimit()` to balance performance.
Can I enforce distinct values across multiple multiselect fields?
Yes, use the `distinct()` method to group fields and prevent duplicate values. For example, `->distinct('category')` ensures no overlapping selections in fields sharing the same group. Note that distinct logic runs client-side, so validate server-side for edge cases like concurrent edits.
Will this package work with BelongsToMany relationships?
Yes, the package natively supports `BelongsToMany` relationships. Use `->asyncResource()` with the related model to populate options dynamically. However, avoid unbounded pivot tables—large datasets may degrade UI responsiveness. Test with `optionsLimit()` to optimize performance.
How do I customize the multiselect UI (e.g., tags, colors, or dark mode)?
Extend the Vue.js components (e.g., `NovaMultiselectDetailFieldValue`) or override CSS classes. The package supports Nova’s light/dark themes out of the box, but conflicts may require custom styles. Check the `resources/js` directory for entry points to override default behavior.
Is there a performance impact when using drag-and-drop reordering?
Drag-and-drop reordering (`->reorderable()`) adds minor frontend overhead but is optimized for small-to-medium lists. For large datasets, consider disabling it or using `optionsLimit()` to reduce the number of rendered options. Test with your expected dataset size to ensure smooth UX.
Can I add custom tags or values on the fly (like a tagging system)?
Yes, enable the `taggable()` method to allow users to add new values dynamically. This is useful for open-ended tagging systems. Under the hood, it appends new options to the existing list, but ensure your backend can handle unsaved values if needed.
What are the risks of using JSON storage for multiselect fields?
JSON storage (via `saveAsJSON()`) offers better querying capabilities but requires database support (PostgreSQL/MySQL 5.7+). If migrating from text storage, ensure your schema supports JSON columns. Querying individual array elements may need custom database functions or application logic.
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.
terminal42/code-quality-tools
codifyo/ts-generator-bundle
andydefer/laravel-cluster
testo/fiber
mintobit/jobqueue
a4sex/maintenance-bundle
a4sex/entity-date-update
a4sex/client-identifier
a4sex/base-utilites
a4sex/key-value-storage
a4sex/micro-status
chilldev/dependency-injection-extra
datinglibre/datinglibre-app-api
biberltd/corebundle
bricre/symfony-bundle-test
biberltd/logbundle
dominium/http-adapter-bundle
dominium/google-analytics
a4sex/auto-clean-entity
christhompsontldr/laravel-inky