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

#[In]

Stage: VALIDATE (3)

Validates that the payload value is within a predefined set of allowed values. If the value is not in the set, the filter is skipped silently.


Parameters

ParameterTypeRequiredDescription
...$valuesmixed✅The allowed values (variadic)

Usage

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

#[In('active', 'pending', 'archived')]
protected function status(Payload $payload)
{
    return $this->builder->where('status', $payload->value);
}

Behavior

ScenarioResult
Value is in the allowed setFilter executes normally
Value is not in the setFilter is skipped (SkipExecution thrown)

Examples

Restrict to Specific Types

#[In('post', 'page', 'article')]
protected function type(Payload $payload)
{
    return $this->builder->where('type', $payload->value);
}

Numeric Values

#[In(1, 2, 3, 4, 5)]
protected function rating(Payload $payload)
{
    return $this->builder->where('rating', $payload->value);
}

Combining with Transform Attributes

#[Trim]
#[Sanitize('lowercase')]
#[In('active', 'pending', 'archived')]
protected function status(Payload $payload)
{
    // "  ACTIVE  " → "active" → passes In check
    return $this->builder->where('status', $payload->value);
}
Edit this page
Last Updated:
Contributors: kettasoft
Prev
Required
Next
Between