Filter Operations

Filter operations are used to apply specific conditions to the data being queried. They help in narrowing down the results based on various criteria. Filter operations are registered in the config/visualizations.php file under the filters key. Each filter operation class must implement the FilterOperationContract interface.

Configuration

The filter operations are configured in the config/visualizations.php file:

php
<?php

return [
    'filters' => [
         // Equality
        Equals::class,
        DoesNotEqual::class,

        // In
        In::class,
        NotIn::class,

        // Numeric
        GreaterThan::class,
        GreaterThanOrEqualTo::class,
        LessThan::class,
        LessThanOrEqualTo::class,

        // String
        Contains::class,
        DoesNotContain::class,
        EndsWith::class,
        StartsWith::class,
    ],
];

This configuration ensures that the specified filters are available for use in the application. Each filter class defines the conditions it can handle and the logic to apply those conditions to the query.

Available Filter Operations

Equality

Filter OperationDescription
EqualsChecks if a value is equal to the specified value.
DoesNotEqualChecks if a value is not equal to the specified value.

Strings

Filter OperationDescription
ContainsChecks if a string contains the specified substring.
DoesNotContainChecks if a string does not contain the specified substring.
EndsWithChecks if a string ends with the specified substring.
StartsWithChecks if a string starts with the specified substring.

Numeric

Filter OperationDescription
GreaterThanChecks if a value is greater than the specified value.
GreaterThanOrEqualToChecks if a value is greater than or equal to the specified value.
LessThanChecks if a value is less than the specified value.
LessThanOrEqualToChecks if a value is less than or equal to the specified value.

Sets

Filter OperationDescription
InChecks if a value is within a specified set of values.
NotInChecks if a value is not within a specified set of values.