To order the items model by a specific column on the eloquent relationship, you can modify the orderBy clause to include the relationship column name. In this case, you can use 'products.price' to order by the min_price column on the products relationship. Here's an example:
@strafe I don't really understand the logic of ordering by withCount:
->withCount(['products' => function($query) {
$query->select(DB::raw('min(min_price) as price'));
This part doesn't make much sense: so you're counting all the products of an item - why select min price here?
Shouldn't that select min price be in the with() and not in the withCount()?
I would generally suggest you write an SQL query on paper first, so you would understand what is actually being queried, and then transform it into Eloquent.