This commit is contained in:
elvira committed 2026-10-26 16:06:55 +02:00
1 parent 50ec0eebf2
commit 1e4da2c8cc
73 files changed
+763 -43

No files matched your search

+16
View File
@@ -179,6 +179,22 @@ public static function hasMany(
));
}
// hasMany() with each entry's current-locale fields layered on top (see
// localeOverrides). $folder is both the relation prefix and the content
// folder, e.g. "faqs". Refs pointing at deleted entries are dropped.
public static function localizedRelation(
string $relation,
?array $slugs,
string $folder,
) {
return static::hasMany($relation, $slugs ?? [], $folder)
->filter()
->map(fn($entry) => $entry->forceFill(
static::localeOverrides("{$folder}/{$entry->slug}.md"),
))
->values();
}
public static function hasOne(
string $relation,
string $slug,