Fix: Recommendations are an eloquent collection, not an Generic Collection
This commit is contained in:
@@ -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) {
|
||||||
|
|||||||
Reference in New Issue
Block a user