Eigene Fotokategorie fuer Grundrisse und Plaene, nie in Galerien

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
LarsandClaude Opus 5.5 committed 2026-10-29 18:43:02 +01:00
1 parent 8bcda9a4bc
commit d02f3e05c7
7 files changed
+85 -4

No files matched your search

+2 -2
View File
@@ -32,7 +32,7 @@ public static function schema(): array
{
return [
TextInput::make('heading')->label('Überschrift')->maxLength(120),
Select::make('category')->label('Bilder')->options(['all' => 'Alle', ...collect(PhotoCategory::cases())->mapWithKeys(fn (PhotoCategory $category): array => [$category->value => $category->getLabel()])->all()])->default('all'),
Select::make('category')->label('Bilder')->options(['all' => 'Alle', ...collect(PhotoCategory::forGalleries())->mapWithKeys(fn (PhotoCategory $category): array => [$category->value => $category->getLabel()])->all()])->default('all'),
TextInput::make('limit')->label('Anzahl (leer = alle)')->integer()->minValue(1),
];
}
@@ -48,7 +48,7 @@ public function data(Theme $theme, array $data): array
return [
'heading' => $data['heading'] ?? null,
'photos' => $this->withSeasonalPhotos($theme, $data, 'photo_ids', Photo::query()->published()->forProperty($theme->property())->with('media')
'photos' => $this->withSeasonalPhotos($theme, $data, 'photo_ids', Photo::query()->published()->forGalleries()->forProperty($theme->property())->with('media')
->when($category, fn ($query) => $query->where('category', $category))
->when(filled($data['limit'] ?? null), fn ($query) => $query->limit((int) $data['limit']))
->get()),
+1 -1
View File
@@ -53,7 +53,7 @@ public function data(Theme $theme, array $data): array
{
$fallback = isset($data['photo_id'])
? Photo::find($data['photo_id'])
: Photo::query()->published()->when($theme->property(), fn ($query, $property) => $query->whereBelongsTo($property))->first() ?? Photo::query()->published()->first();
: Photo::query()->published()->forGalleries()->when($theme->property(), fn ($query, $property) => $query->whereBelongsTo($property))->first() ?? Photo::query()->published()->forGalleries()->first();
$featuredOffer = ($data['show_offer'] ?? true) && $theme->property()
? app(OfferShowcase::class)->current($theme->property(), limit: 1, featuredOnly: true)->first()
: null;