PHP code example of mkamel / searchable

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

    

mkamel / searchable example snippets


MKamel\Searchable\SearchableServiceProvider::class,

User::search([
  'name' => 'alex',
  'older_than' => 20
]);

class ByOlderThanFilter
{
  public function apply($query, $key, $value)
  {
    return $query
      ->where('age', '>=', $value)
  }
}