chore: commit current workspace changes
This commit is contained in:
@@ -546,6 +546,32 @@ class World extends Model
|
||||
return static::canonicalEditionIdForRecurrence((string) $this->recurrence_key) === (int) $this->id;
|
||||
}
|
||||
|
||||
public static function primeCanonicalEditionIds(iterable $recurrenceKeys): void
|
||||
{
|
||||
$keys = collect($recurrenceKeys)
|
||||
->map(static fn ($key): string => trim((string) $key))
|
||||
->filter()
|
||||
->unique()
|
||||
->reject(static fn (string $key): bool => array_key_exists($key, static::$canonicalRecurrenceEditionIds))
|
||||
->values();
|
||||
|
||||
if ($keys->isEmpty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
$editionsByRecurrence = static::query()
|
||||
->publiclyVisible()
|
||||
->whereIn('recurrence_key', $keys->all())
|
||||
->get()
|
||||
->groupBy('recurrence_key');
|
||||
|
||||
foreach ($keys as $key) {
|
||||
$canonical = static::selectCanonicalEdition(new EloquentCollection($editionsByRecurrence->get($key, collect())->all()));
|
||||
|
||||
static::$canonicalRecurrenceEditionIds[$key] = $canonical ? (int) $canonical->id : null;
|
||||
}
|
||||
}
|
||||
|
||||
public function sectionOrder(): array
|
||||
{
|
||||
$defaults = array_values(array_filter(config('worlds.default_section_order', []), 'is_string'));
|
||||
|
||||
Reference in New Issue
Block a user