PHP code example of firevel / filterable
1. Go to this page and download the library: Download firevel/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/ */
firevel / filterable example snippets
use Firevel\Filterable\Filterable;
class User extends Model
{
use Filterable;
protected $filterable = [
'user_id' => 'id',
'name' => 'string',
'created_at' => 'datetime',
// ... other attributes ...
];
}
// Fetch users with user_id equal to 5
$users = User::filter(['user_id' => ['=' => 5]])->get();
// Fetch users created after a certain date
$users = User::filter(['created_at' => ['>' => '2023-01-01']])->get();
// ... other filter combinations ...