定制 jwohlfert23/laravel-api-query 二次开发

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

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

jwohlfert23/laravel-api-query

最新稳定版本:5.1.0

Composer 安装命令:

composer require jwohlfert23/laravel-api-query

包简介

Provides laravel scope to build query from request query params

README 文档

README

Installation

composer require jwohlfert23/laravel-api-query

Usage

This package is implemented as a trait, which provides the buildFromRequest scope.

use Jwohlfert23\LaravelApiQuery\BuildQueryFromRequest; class Post { use BuildQueryFromRequest; }
Post::buildFromRequest()->get();

?sort=-id,name

is the same as:

Post::orderByDesc('id')->orderBy('name');

?filter[name]=Bobby&filter[author.name][contains]=Bob

is the same as:

Post::where('name', 'Bobby')->whereHas('author', function($q) { $q->where('name', 'like', '%Bob%'); });

Note: this package doesn't use "whereHas", but rather performs left joins internally. However, the results should be the same as the above code.

Filters default to using the "equal" operator. These are the operators available to use in filtering (contains is use above).

  • eq (=)
  • gt (>)
  • gte (>=)
  • lt (<)
  • lte (<=)
  • contains

?with=author,comments

is the same as

Post::with('author','comments');

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-01-04

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固