FilterableFilterable
Home
📦 Installation
  • Setting Up Filterable
  • Discover Command
  • Listing All Filters
  • Testing Filters
  • Inspecting Filterable Classes
  • Caching
GitHub
Home
📦 Installation
  • Setting Up Filterable
  • Discover Command
  • Listing All Filters
  • Testing Filters
  • Inspecting Filterable Classes
  • Caching
GitHub
  • Home
  • Introduction
  • Installation
  • Service Provider
  • How It Works
  • Engines

    • Invokable

      • Overview
      • Annotations

        • Overview
        • Authorize
        • SkipIf
        • Trim
        • Sanitize
        • Cast
        • DefaultValue
        • MapValue
        • Explode
        • Required
        • In
        • Between
        • Regex
        • Scope
    • Tree
    • Ruleset
    • Expression
  • Features

    • Lifecycle Hooks
    • Header-Driven Filter Mode
    • Auto Register Filterable Macro
    • Conditional Logic
    • Filter Aliases
    • Through callbacks
    • Auto Binding
    • Custom engines
    • Data Provisioning
  • Execution

    • Invoker
  • API Reference

    • Filterable
    • Filterable facade
    • Payload
    • Sorter
  • Caching

    • Overview
    • Getting Started
    • Strategies
    • Auto Invalidation
    • Cache Profiles
    • Scoping Cache
    • Monitoring Cached Items
    • API Reference
    • Examples
  • CLI

    • Setup Filterable
    • Discover Filters
    • Test Filter
    • List Filters
    • Inspect Filter
  • Exceptions
  • Event System
  • Profile Management
  • Profiler
  • Sorting
  • Authorization
  • Validation
  • Sanitization

#[Between]

Stage: VALIDATE (3)

Validates that the payload value falls within a specified numeric range. If the value is outside the range or not numeric, the filter is skipped.


Parameters

ParameterTypeRequiredDescription
$minfloat|int✅Minimum allowed value
$maxfloat|int✅Maximum allowed value

Usage

Integer Range

use Kettasoft\Filterable\Engines\Foundation\Attributes\Annotations\Between;

#[Between(min: 1, max: 100)]
protected function views(Payload $payload)
{
    return $this->builder->where('views', '>=', $payload->value);
}

Float Range

#[Between(min: 0.0, max: 5.0)]
protected function rating(Payload $payload)
{
    return $this->builder->where('rating', '>=', $payload->value);
}

Behavior

ScenarioResult
Value is numeric and within rangeFilter executes normally
Value is at the minimum boundaryFilter executes normally (inclusive)
Value is at the maximum boundaryFilter executes normally (inclusive)
Value is below the rangeFilter is skipped
Value is above the rangeFilter is skipped
Value is not numericFilter is skipped

Boundary Behavior

The check is inclusive on both ends:

#[Between(min: 1, max: 100)]
// 1   → ✅ passes
// 50  → ✅ passes
// 100 → ✅ passes
// 0   → ❌ skipped
// 101 → ❌ skipped

Combining with Other Attributes

#[SkipIf('empty')]
#[Trim]
#[Between(min: 1, max: 1000)]
protected function price(Payload $payload)
{
    return $this->builder->where('price', '>=', $payload->value);
}
Edit this page
Last Updated:
Contributors: kettasoft
Prev
In
Next
Regex