Skip to content

Fix User column searchable() callback for Filament 5.7.8 - #40

Merged
swilla merged 1 commit into
mainfrom
fix/filament-5-7-searchable-query
Sep 7, 2026
Merged

Fix User column searchable() callback for Filament 5.7.8#40
swilla merged 1 commit into
mainfrom
fix/filament-5-7-searchable-query

Conversation

@swilla

@swilla swilla commented Sep 7, 2026

Copy link
Copy Markdown
Member

Details

Filament table TextColumn::searchable() first argument is a condition (bool|array|string|Closure), not the search query. The second argument (query) is the custom search callback.

LibraryItemPermissionsRelationManager passed a function ($query, $search) as the first argument. Filament therefore treated it as isSearchable and evaluated it during table render.

In Filament 5.7.8 that evaluation injects $query as null, which crashes host apps (e.g. Communities-of-Excellence ResourceLibraryContractTest) with:

Call to a member function where() on null

at LibraryItemPermissionsRelationManager.php in the searchable closure.

Fix

Pass the custom user-name search via the named query: argument so:

  • the column remains searchable
  • the SQL callback runs only during search, with a real query builder
->searchable(query: function ($query, $search) {
    return $query->where(/* ... */);
})

Release

This needs a tagged release (v1.4.1) so Packagist consumers can bump. Communities PR https://github.com/TappNetwork/Communities-of-Excellence/pull/193 will consume this commit until that release is published.

Filament table TextColumn::searchable() treats the first argument as a
condition (bool|array|string|Closure), not the search query. Passing a
closure there makes isSearchable() evaluate it during table render.

In Filament 5.7.8 that evaluation injects a null $query, causing
"Call to a member function where() on null".

Pass the custom user-name search as the query: argument so the column
stays searchable without running the SQL callback on render.
@swilla
swilla merged commit c6770b7 into main Sep 7, 2026
9 checks passed
@swilla
swilla deleted the fix/filament-5-7-searchable-query branch September 7, 2026 15:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant