Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Eloquent Filtering Laravel Package

indexzer0/eloquent-filtering

Define allowed filters on your Eloquent models and apply them from simple arrays or request data—no custom query logic. Supports complex, type-based filtering for APIs and dashboards on Laravel 10+ / PHP 8.2+.

View on GitHub
Deep Wiki
Context7

title: 'Modifiers' version: 'v2' icon: 'pen' iconType: 'solid'

Overview

Modifiers are ways to slightly alter the way that a filter works.

How To Use

Append :{modifierName} to the type of the filter.

$filter = [
    'type'   => '$like:start',
    'target' => 'framework',
    'value'  => 'laravel',
];

Multiple modifiers can be applied.

$filter = [
    'type'   => '$like:start:end',
    'target' => 'framework',
    'value'  => 'laravel',
];

Core Filter Modifiers

Some of the core filters provided by this package have modifiers.

$like <Icon icon="link" iconType="solid" />

  • :start - matches only the start of field LIKE 'Laravel%'.
  • :end - matches only the end of field LIKE '%Laravel'.

$notLike <Icon icon="link" iconType="solid" />

  • :start - matches only the start of field NOT LIKE 'Laravel%'.
  • :end - matches only the end of field NOT LIKE '%Laravel'.

$in <Icon icon="link" iconType="solid" />

  • :null - also does a or "{$target}" is null.

$notIn <Icon icon="link" iconType="solid" />

  • :null- also does a and "{$target}" is not null.

Configuring Modifiers

By default, all filter modifiers are enabled.

Allowing

Though, you can specify only specific modifiers to enable.

public function allowedFilters(): AllowedFilterList
{
    return Filter::only(
        Filter::field('name', [FilterType::LIKE->withModifiers('end')])
    );
}

Disabling

You can also disable all modifiers.

public function allowedFilters(): AllowedFilterList
{
    return Filter::only(
        Filter::field('name', [FilterType::LIKE->withoutModifiers()])
    );
}
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
jayeshmepani/jpl-moshier-ephemeris-php
elnasnato/laraliveui
labrodev/rest-sdk
sampaui/sampaui
babelqueue/php-sdk
facebook/capi-param-builder-php
babelqueue/symfony
hamzi/corewatch
minionfactory/raw-hydrator
hexters/coinpayment
rjcodes/rjcms
act-training/laravel-permissions-manager
alimarchal/laravel-chart-of-accounts
babenkoivan/elastic-scout-driver
mkwebdesign/filament-watchdog-v5
renatomarinho/laravel-page-speed
zedmagdy/filament-business-hours
renatovdemoura/blade-elements-ui
devgeek/beacon-admin
benjamin-rqt/data-watcher-bundle