Full text search with Laravel Scout and Spatie Laravel Query Builder

Submitted by flix - 1 month ago

Suppose you want to use Laravel query builder to search items in your db like this ?filter[search]=yourkeyword

//your model
 * Scope a query to only include services matching the search term.
public function scopeWhereScout(Builder $query, string $search): Builder
    return $query->whereIn(

//your controller

$models = QueryBuilder::for(Model::class)
                AllowedFilter::scope('search', 'whereScout'),