Short answer
No. A limit() placed inside the Table query() callback does not override Table::paginate(). Filament passes the modified builder to Laravel's paginator, so the paginator’s per‑page value controls the rows fetched for the current page, while the manual limit() stays on the builder and interferes with the paginator’s count query and offsets.
Confirmed facts
- Filament Tables use Laravel’s paginator for per‑page controls.
Table::paginate() sets the paginator’s per‑page value (default 25).
- The
query() callback receives the Eloquent/query builder before pagination is applied; any changes you make there remain when Filament calls paginate() on that builder.
- Filament has no documented “max total rows” table API and does not strip a manual
limit() before paginating.
Likely explanation (version‑sensitive)
When paginate() runs, Laravel adds its own LIMIT and OFFSET for the requested page on top of the builder state. For the data query the paginator’s per‑page limit is the effective limit for that page. The count query used to build the pagination total is also built from the same builder. If a limit() is present, the count query can be affected differently across Laravel versions, leading to:
- Page 1 showing up to the per‑page rows.
- Page 2 + returning zero rows because the
OFFSET exceeds the manual limit.
- The pagination UI reporting a total that does not match the bounded set.
This interaction is undocumented and not a supported pattern; behavior varies with Laravel and Filament major versions.
Supported ways to bound results while keeping pagination
- Filter instead of capping: narrow the dataset with
where() constraints such as date range, status, ownership. Filtering composes correctly with pagination counts and offsets.
- If a hard cap is truly required, cap the dataset in a subquery so the paginator sees a stable set, e.g.:
// Example: paginate over a limited subquery
$limited = Model::query()->limit(500);
return $limited->paginate(Table::paginate(25)); // pseudo‑code; adjust to your Filament table implementation
Verification steps
Enable query logging and inspect the SQL for page 1 and page 2:
DB::listen(function ($query) {
\\Log::debug($query->sql, $query->bindings);
});
Request page 1 and page 2, compare the data query LIMIT/OFFSET and the count query. If the count query shows the manual limit, the total will be off.
Missing diagnostic detail
To give a version‑specific recommendation, please confirm your Filament major version (v2/v3/v4) and Laravel version (9/10/11/12). The paginator internals and Table API differ between these releases, which determines whether the observed behavior matches the description above.