Seiten · Laravilt
Sorting
Define sort options and apply the active sort.
php
Applying the sort
sortBy() sets the active column and direction, and apply() adds orderBy():
php
sortBy()orders by the value you pass. It doesn't check it against the registeredSortnames, so validate user input yourself:php
Labels
When label() isn't set, the label is the headline form of the name: created_at becomes "Created At".
Methods
| Method | Description |
|---|---|
make(string $name, ?string $column = null) | Create a sort option |
label(string) | Display label |
column(string) | Database column |
defaultDirection(string) | asc or desc (serialized for the frontend) |
visible(bool) | Show or hide the option |
getName(), getColumn(), getLabel() | Getters |