PHP code example of laratribe / laravel-advanced-filters
1. Go to this page and download the library: Download laratribe/laravel-advanced-filters 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/ */
laratribe / laravel-advanced-filters example snippets
use Laratribe\AdvancedFilters\Concerns\HasFilters;
use Laratribe\AdvancedFilters\Contracts\Filterable;
use Laratribe\AdvancedFilters\Filters\{TextFilter, SetFilter, NumericFilter, DateFilter};
class Product extends Model implements Filterable
{
use HasFilters;
public static function filters(): array
{
return [
TextFilter::make('name', 'Name'),
SetFilter::make('category', 'Category')->options([
'electronics' => 'Electronics',
'books' => 'Books',
])->multiple(),
NumericFilter::make('price', 'Price'),
DateFilter::make('released_at', 'Released'),
];
}
}