Tables & Columns
A Resource table defines the columns and filters used on its index page. The column name normally matches an Eloquent attribute. Mark a column searchable or sortable only when that operation makes sense for the data and user.
use SeviaFlow\Core\Resources\Columns\StatusColumn;
use SeviaFlow\Core\Resources\Columns\TextColumn;
use SeviaFlow\Core\Resources\Table;
public static function table(Table $table): Table
{
return $table
->columns([
TextColumn::make('name')->label('Name')->searchable()->sortable(),
StatusColumn::make('status')->label('Status')->options([
'active' => 'Active',
'paused' => 'Paused',
]),
]);
}
Column types
| Column | Use it for | Extra configuration |
|---|---|---|
TextColumn | Plain text and identifiers. | Common column methods. |
NumberColumn | Numeric values. | Common column methods. |
MoneyColumn | Money with currency formatting. | currency(), decimals(). |
StatusColumn | A stored value displayed with a readable label. | options(). |
BadgeColumn | A value displayed as a colored badge. | labels(), colors(). |
BooleanColumn | A true/false model value. | Common column methods. |
BelongsToColumn | The title of a related Eloquent record. | relationship(). |
Configure a column
| Method | What it controls | Example use |
|---|---|---|
make('name') | Selects the Eloquent attribute or relationship represented by the column. | Use the model field the operator should read. |
label('Customer name') | Sets the displayed table heading. If omitted, SeviaFlow derives a readable label from the name. | Use a business-friendly heading or explain an abbreviation. |
searchable() | Adds this column to the Resource's global text-search fields. | Enable when matching this value is useful from the list search box. |
searchable(mode: 'exact') | Sets the match mode for this searchable column: contains, starts_with, or exact. | Use exact matching for an identifier or other value where prefix/substring search is misleading. |
searchableUsing(...) | Registers a custom query callback for searching this column. | Use when the model attribute needs custom query logic. |
sortable() | Allows the operator or API client to sort the index by this column. | Enable only when the column has a useful and predictable order. |
visibleOn(...), hiddenOn(...) | Choose which Resource contexts display the column, such as index or show. | Hide technical fields from one surface while retaining them on another. |
Performance and stable sorting
Table::selectOnlyVisibleColumns() can restrict index queries to the columns needed for the visible table. It defaults to the seviaflow.performance.select_only_visible_columns configuration value, which is true. When several records have the same sort value, SeviaFlow adds the model primary key as a tie-breaker so paging remains deterministic.
UI column preferences
Operators can change the visible column order in the UI and save it in a private saved view. This changes only the Resource index presentation. It does not remove fields from API responses or alter the export allowlist. For filters and API query parameters, see Filters & Search and CRUD and Index Queries.
Get Started