In front-end you need some filter forms. To make elefilter work, your form should follow the rule we discussed in query section, can check it here.
Below is an example of a sample form including search, sorting and status. You can use this form globaly for every model and just pass request()->all() to your model in controller. It's a sign that this kind of form, can be a laravel component and be used wherever is needed.
<form method="get">
<label
for=
"asc"
>
oldest</label>
<input
type=
"radio"
name=
"sort"
id=
"asc"
value=
"oldest"
/>
<label
for=
"desc"
>
newest</label>
<input
type=
"radio"
name=
"sort"
id=
"desc"
value=
"newest"
/>
<input
type=
"text"
name=
"search"
/>
<select
name=
"status"
>
<option
value=
"pending"
>
pending</option>
<option
value=
"approved"
>
approved</option>
<option
value=
"rejected"
>
rejected</option>
</select>
</form>
Accordingly should have a SortFilter with methods newest and oldest
SearchFilter with default apply method
And StatusFilter with methods pending, approved, and rejected
© 2025 elefilter