Boolean
class Boolean extends TableColumn (View source)
Methods
No description
Set the field name to be used for this column. This is the field that will be used to query the database.
When enabled the column is sortable by clicking on the header.
When enabled this will be the default column the list is sorted by.
Makes the column optional, when set it can be hidden using the gear icon above the listing.
To be used with ->optional, but it will be hidden by default.
When enabled the content will be rendered as html.
Links the column content to a fixed url or url via the closure.
A separate sortKey if different from the field name.
An optional closure accepting the QueryBuilder and sort direction to apply when this field is being sorted.
Set a custom render function that will receive the model as its function argument.
No description
Details
final protected
__construct(string|null $key = null, string|null $field = null, string|null $title = null, string|null $sortKey = null, bool $sortable = false, bool $defaultSort = false, string $defaultSortDirection = 'ASC', bool $optional = false, bool $linkToEdit = false, bool $visible = true, bool $html = false, Closure|string|null $link = null, Closure|null $render = null, Closure|null $sortFunction = null, string|null $specificType = null, bool $shrink = false)
No description
static TableColumn
make()
No description
string
getKey()
No description
TableColumn
shrink(bool $shrink = true)
No description
TableColumn
field(string $field)
Set the field name to be used for this column. This is the field that will be used to query the database.
If no title is set, it will also update the title.
string
getField()
No description
TableColumn
title(string|null $title)
Sets the title of the column.
TableColumn
sortable(bool $sortable = true)
When enabled the column is sortable by clicking on the header.
TableColumn
sortByDefault(bool $defaultSort = true, string $direction = 'ASC')
When enabled this will be the default column the list is sorted by.
bool
isDefaultSort()
No description
string
getDefaultSortDirection()
No description
TableColumn
optional(bool $optional = true)
Makes the column optional, when set it can be hidden using the gear icon above the listing.
TableColumn
hide(bool $visible = false)
To be used with ->optional, but it will be hidden by default.
TableColumn
renderHtml(bool $html = true)
When enabled the content will be rendered as html.
TableColumn
linkCell(Closure|string $link)
Links the column content to a fixed url or url via the closure.
TableColumn
linkToEdit(bool $linkToEdit = true)
No description
bool
shouldLinkToEdit()
No description
TableColumn
sortKey(string|null $sortKey)
A separate sortKey if different from the field name.
string
getSortKey()
No description
TableColumn
order(Closure $sortFunction)
An optional closure accepting the QueryBuilder and sort direction to apply when this field is being sorted.
If you are using the Relation field, this sort is required to make it work. Please note that when you are having a belongsToMany you have to carefully write your join because otherwise you may end up with duplicate rows.
Closure|null
getOrderFunction()
No description
TableColumn
customRender(Closure $renderFunction)
Set a custom render function that will receive the model as its function argument.
You can use this to display for example a view or formatted date.
array
toColumnArray(array $visibleColumns = [], bool $sortable = true)
No description
string
renderCell(TwillModelContract $model)
No description
protected int|bool|string
getRenderValue(TwillModelContract $model)
No description