PHP code example of smartisan / laravel-query-filter

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

    

smartisan / laravel-query-filter example snippets


namespace App\Filters;

use Smartisan\QueryFilter\QueryFilter;

class UserFilter extends QueryFilter
{
    public function status($value)
    {
        return $this->builder->where('status', $value);
    }
}

use App\Filters\UserFilter;

public function index()
{
    User::filter(UserFilter::class)->get();
}
bash
php artisan vendor:publish --provider="Smartisan\QueryFilter\QueryFilterServiceProvider" --tag="config"