I'm organizing some list objects by their names, but I want to sort them without having to page them. The code that I have is the following:
if ($filter['sort'] == 'name_asc'){
return Employee::orderBy('first_name', 'ASC')->paginate(1000);
} else if ($filter['sort'] == 'name_desc') {
return Employee::orderBy('first_name', 'DESC')->paginate(1000);
}
But I want to return the Employees without the need of the method (paginate). How could I solve it?