PHP code example of rondigital / query-filter

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

    

rondigital / query-filter example snippets


composer 

use Rondigital\QueryFilter\QueryFilter;

class YourClass {

use QueryFilter;
// ...
}
 
$model = Model::all();
return $this->query($model, $request);
 
 http://localhost:8000/api/files?search=pdf&searchColumn=extension&filteredBy=today&orderType=asc&orderBy=extension&perPage=1

{
    "current_page": 1,
    "data": [
        {
            "id": 6,
            "user_id": 23,
            "filename": "1686910391_siuqkT7MvLsmvpVH",
            "real_filename": "seller-288138-barkod-bazlı-iptal-raporu-2023.05.03-18.17.56.pdf",
            "extension": "pdf",
            "deleted_at": null,
            "created_at": "2023-06-16T10:13:11.000000Z",
            "updated_at": "2023-06-16T10:13:11.000000Z"
        }
    ],
    "first_page_url": "http://localhost:8008/api/files?page=1",
    "from": 1,
    "last_page": 3,
    "last_page_url": "http://localhost:8008/api/files?page=3",
    "links": [
        {
            "url": null,
            "label": "&laquo; Previous",
            "active": false
        },
        {
            "url": "http://localhost:8008/api/files?page=1",
            "label": "1",
            "active": true
        },
        {
            "url": "http://localhost:8008/api/files?page=2",
            "label": "2",
            "active": false
        },
        {
            "url": "http://localhost:8008/api/files?page=3",
            "label": "3",
            "active": false
        },
        {
            "url": "http://localhost:8008/api/files?page=2",
            "label": "Next &raquo;",
            "active": false
        }
    ],
    "next_page_url": "http://localhost:8008/api/files?page=2",
    "path": "http://localhost:8008/api/files",
    "per_page": 1,
    "prev_page_url": null,
    "to": 1,
    "total": 3
}