| @@ -336,8 +336,10 @@ | ||
| 336 | 336 | * |
| 337 | 337 | */ |
| 338 | 338 | public static function topProductsSold($params = []) |
| 339 | 339 | { |
| 340 | + $params = is_array($params) ? $params : []; | |
| 341 | + | |
| 340 | 342 | return OrderItem::search(Arr::only($params, ['created_at'])) |
| 341 | 343 | ->select('post_id') |
| 342 | 344 | ->selectRaw('SUM(quantity) as total_sold') |
| 343 | 345 | ->groupBy('post_id') |