Tucker-Eric / EloquentFilter

An Eloquent Way To Filter Laravel Models And Their Relationships
http://tucker-eric.github.io/EloquentFilter
MIT License
1.72k stars 120 forks source link

Feature: sort mechanism #174

Closed ryanlcr55 closed 2 years ago

ryanlcr55 commented 2 years ago

When input has order_by column, apply order query to the eloquent automatically

Tucker-Eric commented 2 years ago

Without adding the additional complexity, this can currently be done by adding an orderBy method on the filter:

public function orderBy($orderBy)
{
    return $this->query->orderBy($orderBy, $this->input('order', 'DESC'));
}