定制 rondigital/query-filter 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

rondigital/query-filter

最新稳定版本:v1.5

Composer 安装命令:

composer require rondigital/query-filter

包简介

Filter and search in Laravel Model.

README 文档

README

Filter and search in Laravel Model.

composer require rondigital/query-filter

The QueryFilter is a trait used for filter, multiple filter and search in Laravel Model. You can install it using the composer command mentioned above. To use it in your class, add the following line with the "use" keyword:

use Rondigital\QueryFilter\QueryFilter;

class YourClass {

use QueryFilter;
// ...
}

Parameters:

  • startingDate : must be Y-M-D H:i:s
  • endingDate : must be Y-M-D H:i:s
  • filteredBy : must be;
    • today
    • last-24
    • last-7-day
    • last-30-day
    • last-60-day
    • last-90-day
    • last-year
    • this-month
    • last-month
    • this-week
    • last-week
  • search : must be search value
    • searchColumn : must be column name
  • orderBy : must be column name
  • orderType : must be asc/desc

Inside your function, you can use it as follows:

$model = Model::all();
return $this->query($model, $request);

ex:

 http://localhost:8000/api/files?search=pdf&searchColumn=extension&filteredBy=today&orderType=asc&orderBy=extension&perPage=1

Response / 200 OK

{
    "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": "« 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 »",
            "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
}

统计信息

  • 总下载量: 2.17k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2023-08-11