© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
FilamentF
Filament•15mo ago•
1 reply
wazkaz

TextColumn searchable function anomaly.

Hello, I am using the
TextColumn
TextColumn
's
->searchable()
->searchable()
function, and I've modified the query. When I test the search and enter the search parameter, the table is empty, even though it should return records. I tested the MySQL query directly, and it works, returning the correct records. I also used
dd()
dd()
on the query with
->get()
->get()
at the end, and it returned the correct results. The column value is also a custom value. What could be the issue? Can anyone help me?
TextColumn::make('quantity')
    ->label(__('Quantity'))
    ->searchable(query: function ($query, $search) {
        return $query->join('order_lines', 'orders.id', '=', 'order_lines.order_id')
            ->join('products', 'order_lines.product_id', '=', 'products.id')
            ->select('orders.*')
            ->groupBy('orders.id')
            ->havingRaw('SUM(order_lines.quantity) LIKE ?', ["%{$search}%"]);
    })
    ->getStateUsing(function (Order $record) {
        return $record->products->sum('order_line.quantity');
    })
    ->sortable(),
TextColumn::make('quantity')
    ->label(__('Quantity'))
    ->searchable(query: function ($query, $search) {
        return $query->join('order_lines', 'orders.id', '=', 'order_lines.order_id')
            ->join('products', 'order_lines.product_id', '=', 'products.id')
            ->select('orders.*')
            ->groupBy('orders.id')
            ->havingRaw('SUM(order_lines.quantity) LIKE ?', ["%{$search}%"]);
    })
    ->getStateUsing(function (Order $record) {
        return $record->products->sum('order_line.quantity');
    })
    ->sortable(),
Filament banner
FilamentJoin
A powerful open source UI framework for Laravel • Build and ship admin panels & apps fast with Livewire
20,307Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

Error in searchable TextColumn
FilamentFFilament / ❓┊help
13mo ago
BelongsToMany TextColumn first_name last_name searchable
FilamentFFilament / ❓┊help
3y ago
How to set TextColumn isHidden / Disabled but searchable?
FilamentFFilament / ❓┊help
3y ago
Display TextColumn based on model function
FilamentFFilament / ❓┊help
3y ago