Fix: Recommendations are an eloquent collection, not an Generic Collection

This commit is contained in:
2026-09-01 13:03:39 +03:00
parent ce405d20e6
commit 483c0ce00f
@@ -2,7 +2,7 @@
namespace Modules\Core\Catalog\Services; namespace Modules\Core\Catalog\Services;
use Illuminate\Support\Collection; use Illuminate\Database\Eloquent\Collection;
use Lunar\Models\Product; use Lunar\Models\Product;
use Modules\Core\Catalog\Contracts\RecommendationRule; use Modules\Core\Catalog\Contracts\RecommendationRule;
@@ -25,7 +25,7 @@ class RecommendationService
*/ */
public function recommend(Product $product, int $limit = 4): Collection public function recommend(Product $product, int $limit = 4): Collection
{ {
$recommendations = collect(); $recommendations = new Collection();
foreach (config('catalog.recommendation_rules', []) as $ruleClass) { foreach (config('catalog.recommendation_rules', []) as $ruleClass) {
if ($recommendations->count() >= $limit) { if ($recommendations->count() >= $limit) {