- How do I install the Nova multiselect filter package?
- Run composer require optimistdigital/nova-multiselect-filter to add it to your Laravel project. Then create a filter class that extends Outl1ne\NovaMultiselectFilter\MultiselectFilter, implement the options() and apply() methods, and register the filter in your Nova resource's filters() method. No service provider, config file, migration, or asset build step is required.
- Which Laravel Nova versions does nova-multiselect-filter support?
- The package is a thin extension of Nova's native filter contract, so support depends on the Nova major you are running. Check the package's composer.json constraint and README for the exact supported Nova versions before installing. Because Nova asset pipeline changes can silently break third-party filter components, smoke-test the filter on a real resource index after install and after every Nova upgrade.
- Why is my Nova multiselect filter not appearing on the resource index?
- The most common cause is a namespace mismatch: the vendor moved from optimistdigital/nova-multiselect-filter to outl1ne/nova-multiselect-filter, so Composer can succeed while your use statement points at the wrong namespace. Verify the PHP namespace inside vendor/ and confirm your filter class extends the correct MultiselectFilter class. Also confirm the filter is registered in the resource's filters() method and that the Vue component actually mounts on a test index.
- How do I define the options for a Nova multiselect filter?
- Override the options() method in your filter class and return an associative array of option keys to display labels. The keys are what get passed to apply(), and the labels are what the admin sees in the Nova filter panel. You can build the array from a model query, a relationship, or a static list depending on your use case.
- How do I apply multiple selected values in the filter's apply() method?
- Nova passes the selected values to apply() as an array instead of a scalar, so use whereIn rather than a single where clause. Always guard against an empty array before calling whereIn, because an empty whereIn returns zero rows. Option keys come back as strings, which is usually fine for MySQL but may need explicit casting on PostgreSQL or UUID primary keys.
- Why does my Nova resource return zero results when no filter options are selected?
- This is the empty-selection trap: if apply() passes an empty array into whereIn, the query matches nothing and the admin sees an empty table. Add an explicit guard that returns the query unchanged when the selected values array is empty. That keeps the unfiltered index view intact when the filter is cleared.
- Does nova-multiselect-filter work with belongsTo relationship fields?
- Yes. The package supports belongsTo and select-style fields, so you can build options from related records and constrain the foreign key column in apply(). A typical implementation maps related model IDs to labels in options() and uses whereIn on the foreign key column in apply(). Keep the option set reasonably small because the filter's search is client-side.
- Can I set default selected values on the Nova multiselect filter?
- Yes, the package supports configurable default selections. Override the filter's default method to return an array of option keys that should be selected when the filter first loads. Confirm the behavior on a test index after changing defaults, since defaults are serialized into Nova's filter state.
- What is the difference between optimistdigital/nova-multiselect-filter and outl1ne/nova-multiselect-filter?
- They are the same package after a vendor rename. The Composer name moved from optimistdigital/nova-multiselect-filter to outl1ne/nova-multiselect-filter, while most search results still show the old name. Update both the Composer requirement and the PHP use statement, and verify the namespace inside vendor/ if the class cannot be resolved.
- Is nova-multiselect-filter suitable for large option sets?
- No, the filter's search runs client-side over options that are already loaded, so it is not a server-side searchable select. A select-all over a large table can also produce a whereIn with thousands of bindings. Keep option sets small enough for a dropdown, or use a different filter for large datasets.