Skip to main content
Use NativeResourceSource for an existing Filament resource. Use CallbackSearchSource when data comes from a separate query, service or external index.

A paginated source

This example assumes a tenant-enabled panel and a workspace_id relationship in your application. Adapt the scope to your schema. Parameter binding protects SQL values; literal wildcard handling and database indexing remain application decisions. The callback must return SearchPage. Return at most $request->perPage results, never a complete unbounded collection. SearchPage accepts at most 100 items and a next cursor of at most 4096 characters.

Cursor pagination

Replace the paginator in the previous callback with:
Use a deterministic, database-supported sort. The transport binds cursor tokens to the current search context. Your source still validates its own cursor format and access rules. A numbered page without a cursor requires an explicit offset strategy; for cursor-only sources, use infinite or load-more pagination.

Whitelisted filters

CustomerSearchService must return a SearchPage. Do not execute arbitrary field names, sort expressions or SQL from context data.

Root search and preload

By default, callback sources are searched after entering their category. root(true) adds the source to root query results; preload: true also permits loading without a query. Keep preload bounded and avoid it for expensive external services.

A reusable source class

Implement SearchSource when a callback becomes too large:
Metadata includes an id, label, icon name, layout (list) and enabled status. Use SearchSourceActions if the source also exposes native navigation Actions through navigationActions(): array.

Add to native root results

The service must return native GlobalSearchResults and enforce its own authorization. mergeWithNative: false replaces the native root result set, while configured navigation, commands and source categories remain separate. Prefer a paginated source for a large external result set.