F
Filament8mo ago
Jakub

multiple values for default sort on tables

In this question somone suggested this method
protected function applyDefaultSortingToTableQuery(Builder $query, string $sortColumn, string $sortDirection): Builder
{
return $query
->orderBy('category', 'ASC')
->orderBy('title', 'ASC');
}
protected function applyDefaultSortingToTableQuery(Builder $query, string $sortColumn, string $sortDirection): Builder
{
return $query
->orderBy('category', 'ASC')
->orderBy('title', 'ASC');
}
https://discord.com/channels/883083792112300104/1136735331912257656 I don't see this in documentation for V3, is this still doable? When I added it MilestoneResource.php nothing happens
protected function applyDefaultSortingToTableQuery(Builder $query, string $sortColumn, string $sortDirection): Builder
{
return $query
->orderBy('status', 'asc')
->orderBy('created_at', 'asc');
}
protected function applyDefaultSortingToTableQuery(Builder $query, string $sortColumn, string $sortDirection): Builder
{
return $query
->orderBy('status', 'asc')
->orderBy('created_at', 'asc');
}
When I added to a page like ListMilestones.php i get this error
No description
1 Reply
LeandroFerreira
LeandroFerreira8mo ago
ListMilestones.php
use Illuminate\Database\Eloquent\Builder;
protected function applyDefaultSortingToTableQuery(Builder $query): Builder
{
return $query
->orderBy('status', 'asc')
->orderBy('created_at', 'asc');
}
use Illuminate\Database\Eloquent\Builder;
protected function applyDefaultSortingToTableQuery(Builder $query): Builder
{
return $query
->orderBy('status', 'asc')
->orderBy('created_at', 'asc');
}
Want results from more Discord servers?
Add your server