PHP code example of catalyzecomm / laravel-filterable

1. Go to this page and download the library: Download catalyzecomm/laravel-filterable 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/ */

    

catalyzecomm / laravel-filterable example snippets


    use Catalyzecomm\Filterable;

    ...

    /**
     * Define an array of filter that allowed to use for this model
     * `key` as class name and `value` as field name(s)
     *
     * @var array
     */
    protected static $allowedFilters = [
        Catalyzecomm\Filters\Sort::class => 'created_at',
        Catalyzecomm\Filters\Keywords::class => 'name,email',
    ];

    $users = User::filterPaginate();

    $users = User::filterAll();