PHP code example of outl1ne / nova-multiselect-filter
1. Go to this page and download the library: Download outl1ne/nova-multiselect-filter library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
outl1ne / nova-multiselect-filter example snippets
use Outl1ne\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');
}
}