Skip to content

tylernathanreed/nova-text-filter

Repository files navigation

Text Filter for Laravel Nova

Latest Version on Packagist Total Downloads

Installation

You can install the package in to a Laravel app that uses Nova via composer:

composer require reedware/nova-text-filter

Usage

Create a new filter and extend the abstract text filter:

<?php

namespace App\Nova\Filters;

use Reedware\NovaTextFilter\TextFilter;

class MyFilter extends TextFilter
{
    /**
    * Apply the filter to the given query.
    *
    * @param  \Illuminate\Http\Request  $request
    * @param  \Illuminate\Database\Eloquent\Builder  $query
    * @param  mixed  $value
    * @return \Illuminate\Database\Eloquent\Builder
    */
    public function apply(Request $request, $query, $value)
    {
        return $query->where('my_column', 'like', "{$value}%");
    }
}

About

Adds a text filter component for resources and lenses.

Resources

Stars

Watchers

Forks

Packages

No packages published