PHP code example of imzeali / filter-eloquent

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

    

imzeali / filter-eloquent example snippets


$q = 'id__eq=100';
new Filter(new User(), $q)->filteredQuery();
//mean
User::where('id',1);

$q = 'id__gt=100,name__like=%baby%';
new Filter(new User(), $q)->filteredQuery();
//User::where('id', ‘>’, ‘100’)->where('name','like','%baby%');


$q = 'user.city__eq=Fuzhou';
new Filter(new Article(), $q)->filteredQuery();
//Article::whereHas('user', function ($query){
//    $query->where('city', '=', 'Fuzhou');
//});