- How do I install the Nova multiselect field?
- Install it with Composer using composer require outl1ne/nova-multiselect-field. The package requires PHP ^8.1 and laravel/nova ^5.0. No package migrations are needed for the default text-column mode, and you add one Multiselect::make() line per field in your Nova resource.
- What database column type does this multiselect field need?
- By default the field stores selected values as a stringified JSON array in a text-based column such as string, text, or varchar. If your column is a real JSON type, call saveAsJSON() so the value is persisted as JSON instead. The storage choice affects model casts, API serialization, filters, and reporting, so decide on a convention before using the field widely.
- How do I use async resource searching with the multiselect field?
- Use asyncResource(Artist::class) to query a Nova resource asynchronously, or point the field at a custom endpoint with api('/your-endpoint'). The async search endpoint must inherit authorization correctly from your Nova resource policies. If a resource is misconfigured, the search endpoint can expose model data, so verify policies before shipping.
- Does this package support searchable single-select fields in Nova?
- Yes. Add singleSelect() to a Multiselect field to get a searchable single-select field. It uses the same option, async, dependency, and taggable features as the multi-select mode. This is useful when you want Nova's Select behavior with search and async querying.
- How do I make one multiselect field depend on another or prevent duplicate selections?
- Use optionsDependOn to make a field's options depend on another field, and distinct('group') to disable values already used by other multiselects in the same group. These front-end behaviors are UX affordances, not enforcement mechanisms. Validate dependent and distinct values server-side in your form request or model rules.
- Can users reorder selected values with drag and drop?
- Yes, add reorderable() to enable drag-and-drop reordering of selected values. You can also control how many options display at once with optionsLimit() and limit selections with max(). The saved order follows the array stored in the column, so account for it in any downstream rendering.
- Is taggable() safe for user-entered values, and how should I validate them?
- taggable() lets users add free-text tags on the fly, which means arbitrary strings can enter the column. The package does not document built-in validation for those values. Add explicit server-side validation rules such as allowed characters, maximum length, and an allowlist or normalization step before relying on the data.
- Which Laravel Nova versions are supported, and is there upgrade risk?
- The current release requires laravel/nova ^5.0 and PHP ^8.1, with parallel branches for Nova 4 and Nova 3. The package reaches into Nova internals, and v4.4.0 raised the minimum Nova 4 version to 4.27 because of an inner method visibility change. Pin Nova versions and test this field during every Nova upgrade.
- How do I store selections as JSON or use a pivot table instead of a text column?
- Call saveAsJSON() when the database column is a real JSON type. For relational data, the package also provides belongsToMany and belongsTo modes that use pivot tables instead of a text column. Choose between controlled vocabulary and open tag list per field, and document that storage convention.
- What are the alternatives to this package, and is it actively maintained?
- Alternatives include Nova's native Select field for simple static option lists and BelongsToMany for relational data, while this package fits multi-value attributes needing search, async sources, dependencies, or tagging. Maintenance comes from a small team, effectively one primary author, with no commercial SLA. If admin availability is critical, consider an internal fork or mirror policy and pin the package version.