Overview

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

How To Use

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

  • i.e. $like:start.

Multiple modifiers can be applied.

  • i.e. $like:start:end.

Core Filter Modifiers

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

$like

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

$notLike

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

$in

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

$notIn

  • :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()])
    );
}