PHP code example of cchery / turbo-filter

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

    

cchery / turbo-filter example snippets


  namespace App\Models;
  
  use Illuminate\Database\Eloquent\Model;
  use TurboFilter\Traits\HasTurboFilters;
  
  class User extends Model{

      use HasTurboFilters;
  
      const FILTER1 = ['name', 'email', 'departamento_id, 'profile.address.city:city_name,another_field1,another_field2'];
  }

$users = User::filter(User::FILTER1)->where('active', 1)->get();

$payload = ['search' => 'john']; // Request o arreglo manual

$users = User::filter(User::FILTER1, $payload)->first();

  $users = User::getOrPaginate();

$users = User::customGet(User::FILTER1);
bash
php artisan vendor:publish --provider="TurboFilter\TurboFilterServiceProvider" --tag=config