Skip to content

Commit cfe8440

Browse files
authored
Merge pull request #285 from andrii-trush/patch-1
Fix query for translatable slug
2 parents 3f270d9 + 85176c7 commit cfe8440

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

src/HasSlug.php

+1-3
Original file line numberDiff line numberDiff line change
@@ -204,9 +204,7 @@ public static function findBySlug(string $slug, array $columns = ['*'], ?callabl
204204
$currentField = "{$field}->{$currentLocale}";
205205
$fallbackField = "{$field}->{$fallbackLocale}";
206206

207-
$query->where($currentField, $slug);
208-
209-
$query->orWhere($fallbackField, $slug);
207+
$query->where(fn ($query) => $query->where($currentField, $slug)->orWhere($fallbackField, $slug));
210208
} else {
211209
$query->where($field, $slug);
212210
}

0 commit comments

Comments
 (0)