Maginium
Docs
Docs
  • Welcome
  • Getting Started
    • Quickstart
    • Installation
    • Structure
  • The Basics
    • Concurrency
    • 🔤Strings
    • ⚙️Actions
    • 🗃️Cache
    • 🗂️Collections
    • 🔲Component
    • ⚙️Config
    • 💬Console
    • 🗃️Database
      • Overview
      • Eloquent
      • Seeder
      • Migration
      • Models
      • Factories
      • Schemas
      • Traits
      • Concerns
    • 🛅Container
    • 🔠Enum
    • 📦Event
    • 📝Log
    • 🔢Pagination
    • 💬Prompts
    • 🌐Request
    • 📡Response
    • ⚡Redis
    • 📏Resize
    • 🔌Serializer
      • Json
      • Serializer
      • Closure Serializer
    • 🔑Uuid
    • 👤Avatar
    • 🔐Hashing
    • 📤Dto
      • Overview
      • Attributes
    • 🌍Locale
    • 🔗Token
      • Api Keys
      • Admin Token
      • Customer Token
    • 🕘Message Queue
    • 🖼️Media
    • Helpers
    • 📜Crud
      • Filters and Sorts
        • introduction
        • Basic Usage
        • JS Examples
          • Available Methods
          • Sorts
          • Filters
        • Rename Fields
        • Relation Fields
        • Changing Params Source
        • Allowed Fields
        • Queries and javascript examples
        • Sort null values last
        • Restrict
        • Custom Filters
  • Commerce Modules
    • API Key Module
    • Auth Module
    • Cart Module
    • Customer Module
    • Inventory Module
    • Fulfillment Module
    • Order Module
    • Payment Module
    • Pricing Module
    • Product Module
    • Promotion Module
    • User Module
  • SDKs and Tools
    • create-maginium-app
    • Maginium CLI
    • JS SDK
    • Storefront Starter
Powered by GitBook
On this page
  1. The Basics
  2. Crud
  3. Filters and Sorts

introduction

PreviousFilters and SortsNextBasic Usage

Last updated 4 months ago

Maginium Framework\Crud is an elegant and efficient filtering and sorting package for Maginium, designed to simplify complex data filtering and sorting logic for eloquent queries. By simply adding filter() to your Eloquent query, you can add the ability for frontend users to apply filters based on URL query string parameters like a breeze.

Features :

  • Rename and restrict fields

  • Various filter methods

  • Simple installation and usage

  • Filter by relation columns

  • Custom filters

  • Multi-column sort

Maginium Framework\Crud is not only developer-friendly but also front-end developer-friendly. Frontend developers can effortlessly filter and sort APIs using the popular package.

Strapi's filter and sort functionality inspires the way this package handles filters.

How Does Framework\Crud Work?

Here is a basic usage example to clarify Framework\Crud's use case.

Add filter() to your query.

$posts = Post::filter()->get();

That's it! Now you can filter your posts by adding query string parameters to the URL.

GET /api/posts?filters[title][$contains]=Framework\Crud
📜
JavaScript qs