Skip to content

Commit

Permalink
Category table prefix fix
Browse files Browse the repository at this point in the history
  • Loading branch information
royduin committed Jul 20, 2022
1 parent bd299c1 commit 9870520
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/Models/Product.php
Original file line number Diff line number Diff line change
Expand Up @@ -157,8 +157,11 @@ public function getBreadcrumbCategoriesAttribute()
return [];
}

return Category::whereIn('entity_id', $categoryIds)
->orderByRaw('FIELD(entity_id,'.implode(',', $categoryIds).')')
$categoryModel = config('rapidez.models.category');
$categoryTable = (new $categoryModel)->getTable();

return Category::whereIn($categoryTable.'.entity_id', $categoryIds)
->orderByRaw('FIELD('.$categoryTable.'.entity_id,'.implode(',', $categoryIds).')')
->get();
}

Expand Down

0 comments on commit 9870520

Please sign in to comment.