GithubHelp home page GithubHelp logo

nova-multiselect-filter's Introduction

Nova Multiselect Filter

Latest Version on Packagist Total Downloads

This Laravel Nova package adds a multiselect to Nova's filters.


  • php: >=7.2
  • laravel/nova: ^3.0


  • Multi select
  • Single select
  • Group select
  • Search







Install the package in a Laravel Nova project via Composer:

composer require optimistdigital/nova-multiselect-filter


The filter can be used when switching Filter class with MultiselectFilter.

use OptimistDigtal\NovaMultiselectFilter\MultiselectFilter;

class BooksByAuthorFilter extends MultiselectFilter
    public function apply(Request $request, $query, $value)
        return $query->whereHas('books', function ($query) use ($value) {
            $query->whereIn('author_id', $value);

    public function options(Request $request)
        return Authors::all()->pluck('name', 'id');

Option groups

Option groups are supported. Their syntax is the same as Laravel's option group syntax.

In this example (from Nova docs), all values are grouped by the group key:

    public function options(Request $request)
        return [
          'cat' => ['label' => 'Cat', 'group' => 'Pets'],
          'dog' => ['label' => 'Dog', 'group' => 'Pets'],
          'eagle' => ['label' => 'Eagle', 'group' => 'Birds'],
          'parrot' => ['label' => 'Parrot', 'group' => 'Birds'],


Possible options you can pass to the filter using the option name as a function, ie ->placeholder('Choose peanuts').

Option type default description
options Array|callable [] Options in an array as key-value pairs (['id' => 'value']).
placeholder String Field name The placeholder string for the input.
max Number Infinite The maximum number of options a user can select.
groupSelect Boolean false For use with option groups - allows the user to select whole groups at once
singleSelect Boolean false Makes the field act as a single select which also means the saved value will not be an array.
optionsLimit Number 1000 The maximum number of options displayed at once. Other options are still accessible through searching.


The translations file can be published by using the following publish command:

php artisan vendor:publish --provider="OptimistDigital\NovaMultiselectFilter\FieldServiceProvider" --tag="translations"

You can then edit the strings to your liking.


This package was inspired by klepak/nova-multiselect-filter


This project is open-sourced software licensed under the MIT license.

nova-multiselect-filter's People


bsormagec avatar tarpsvo avatar





Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.