Provides capability of selecting multiple values with Nova Resource filter.
You can install the package in to a Laravel app that uses Nova via composer:
composer require rcknr/nova-multiselect-filterUse MultiselectFilter class instead of Filter:
use rcknr\Nova\Filters\MultiselectFilter;
class UserType extends MultiselectFilter
{
public function __construct()
{
// define badge / text color
$this->colors([
'Administrator' => '#abc', // badge only, text color depends on badge
'Editor' => [
'color' => '#fff',
'background' => '#ffe309'
]]);
// show searchbar to filter select options
$this->showSearch();
// hide color dots on select list
$this->hideDots();
}
public function apply(Request $request, $query, $value)
{
return $query->whereIn('user_role', $value);
}
public function options(Request $request)
{
return [
'Administrator' => 'admin',
'Editor' => 'editor',
];
}
}