Skip to content

Searching

Override searchable() to return the database columns to search across:

php
class ServerTable extends Table
{
    protected function searchable(): array
    {
        return ['name', 'ip', 'hostname'];
    }
}

Return [] (the default) to disable search. When disabled, the search input is hidden.

How It Works

  • Uses WHERE ... LIKE '%term%' with OR across all listed fields
  • Conditions are wrapped in a grouped WHERE clause (won't interfere with other query scopes)
  • The search term is read from ?search= in the URL
  • Frontend debounces input - 300ms by default (configurable via search_debounce config)
  • Page resets to 1 when the search term changes

Custom Search Input

tsx
<InertiaTable
    tableData={servers}
    renderSearch={({ searchTerm, onSearch }) => (
        <input
            value={searchTerm}
            onChange={(e) => onSearch(e.target.value)}
            placeholder="Filter servers..."
            className="rounded-full px-4 py-2 border"
        />
    )}
/>
vue
<!-- Coming soon -->