I am setting up a listing platform and so far i have made the structure. The listings are shown in a view and integrated with Jscroll. The listings view has a filter as shown below.

I filter the request by using when in the Model query and orderBy in the end with pagination. However the orderBy lasts for first pagination results page and not return intended results after the second page onward. From the second page onward the results are not filtered.
//Controller
$posts = Post::where('status','=', 3)
->when($condition, function ($query, $condition) {
return $query->whereIn('condition', $condition);
}, function ($query) {
return $query->orderBy('created_at','asc');
})
->when($make, function ($query, $make) {
return $query->where('make', $make);
}, function ($query) {
return $query->orderBy('created_at','asc');
})
......
->orderBy('created_at','asc')
->paginate(9);
I am stuck with nowhere to continue. Any help would be greatly appreciated.