0071-laravel-query-builder

Community

Filter, sort, and include APIs safely.

AuthorMrJmpl3
Version1.0.0
Installs0

System Documentation

What problem does it solve?

Building Laravel API endpoints often leads to repetitive, error-prone code for handling filter, sort, include, and fields query parameters while keeping database queries safe and controlled.

Core Features & Use Cases

  • Allowed filters, sorts, and includes: Define exactly which query parameters the API accepts, including partial/exact/beginsWith/endsWith, scopes, callbacks, relation-based filters, and soft-delete handling.
  • Sorting and default ordering: Support aliases, custom sort logic, callbacks (including random ordering), and sensible defaults.
  • Relationship inclusion and field selection: Enable eager loading via allowedIncludes() and optional aggregated includes (count/exists/min/max/sum/avg), along with allowedFields() for controlled projection.
  • Custom extensibility: Implement custom filter/sort/include classes to match domain-specific query rules.

Quick Start

Configure a Laravel controller index method to build a QueryBuilder::for(User::class) endpoint that allows specific filters, sorts, includes, and allowed fields for requests like filter[name], sort, and include.

Dependency Matrix

Required Modules

None required

Components

Standard package

💻 Claude Code Installation

Recommended: Let Claude install automatically. Simply copy and paste the text below to Claude Code.

Please help me install this Skill:
Name: 0071-laravel-query-builder
Download link: https://github.com/MrJmpl3/codex_____data_____configuration/archive/main.zip#0071-laravel-query-builder

Please download this .zip file, extract it, and install it in the .claude/skills/ directory.
View Source Repository

Agent Skills Search Helper

Install a tiny helper to your Agent, search and equip skill from 471,000+ vetted skills library on demand.