Skip to content

Commit

Permalink
Merge pull request #285 from andrii-trush/patch-1
Browse files Browse the repository at this point in the history
Fix query for translatable slug
  • Loading branch information
freekmurze authored Dec 30, 2024
2 parents 3f270d9 + 85176c7 commit cfe8440
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions src/HasSlug.php
Original file line number Diff line number Diff line change
Expand Up @@ -204,9 +204,7 @@ public static function findBySlug(string $slug, array $columns = ['*'], ?callabl
$currentField = "{$field}->{$currentLocale}";
$fallbackField = "{$field}->{$fallbackLocale}";

$query->where($currentField, $slug);

$query->orWhere($fallbackField, $slug);
$query->where(fn ($query) => $query->where($currentField, $slug)->orWhere($fallbackField, $slug));
} else {
$query->where($field, $slug);
}
Expand Down

0 comments on commit cfe8440

Please sign in to comment.