Do you mean this:
{!! $users->appends(['sort' => 'votes'])->render() !!}
?
Greetings pros,
i have watched pagination tutorial by sir jeffrey but i was wondering how can i send the append request on the query and filter the result.
Thank you in advance!
There are two ways to go around it.
First of all, if something simple is needed, this would do:
<a href="{{ url('something') . '?filterKey=filterValue' }}">My Filter</a>
You could then use the filterKey variable in your controller via
$filter = Input::get('filterKey') // or using a Request instance
if ($filter !== null)
{
// do something with my eloquent query builder that might involve the key
$model->where('someImportantFilter', '=', $filter); // like this
}
Of course this is just a very simple example.
You could also do this via a form that submits a GET request, and have a dedicated filter class or repository handle your Input::all() or Input::only() data from the form if the filtering gets more complex.
Please or to participate in this conversation.