LaraGrid
  • LaraGrid
  • Installation
  • Publishable
  • Usage
    • Base Usage
      • Create a Grid
      • Display a Grid
    • Examples
  • Theme
    • Default Theme
    • Customize the Theme
  • Column
    • Description
    • Create a Column
    • Methods
    • Usage
  • Column Group
    • Description
    • Create a ColumnGroup
    • Methods
    • Usage
  • Filter
    • Description
    • Available Filters
    • Usage
    • Custom Builder
    • Custom filter
    • Show filtering and sorting in url
  • Filter Reset Button
    • Description
    • Usage
    • Customization
  • Layout
    • Description
    • Usage
  • PowerJoins in LaraGrid
    • Why do we use it
Powered by GitBook
On this page

Was this helpful?

  1. Filter

Custom Builder

You can also define a custom builder for a filter. This is useful when you want to modify the query builder based on the filter's value.

Column::make('name', 'Name')
    ->setFilter(
        TextFilter::make()
            ->setBuilder(function ($builder, $value) {
                $builder->where('name', 'LIKE', "%{$value}%");
            })
        ),
PreviousUsageNextCustom filter

Last updated 1 year ago

Was this helpful?