PHP code example of kayckmatias / z-filters

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

    

kayckmatias / z-filters example snippets


public function scopeFilterBy(Builder $query, array $filters)
{
    $filter = new UsersFilter($query, $filters);

    return $filter->apply();
}

'custom_name' => 'column to verify set whereIn'

'departaments' => 'departament_id'

'custom_name' => ['relation' => 'column to verify set whereIn']

'departments_manager' => ['departments' => 'manager_id']

'search' => function ($q, $filterValue) {
    $q->where(function ($q) use ($filterValue) {
        $q->where('name', 'LIKE', "%" . $filterValue . "%");
        $q->orWhere('summary', 'LIKE', "%" . $filterValue . "%");
    });
}
bash
php artisan make:zfilter NameFilter