Files
fewo-stommer/app/Filament/Resources/Photos/Schemas/PhotoForm.php
T
LarsandClaude Opus 5.5 8bcda9a4bc Wohnungsumschalter im Verwaltungsmenue und wohnungsbezogene Listen
Oben im Seitenmenue waehlt man die Wohnung; Listen, neue Eintraege, Belegungsplan
und Preise & Angebote folgen ihr. Ein geoeffneter Eintrag einer anderen Wohnung
schaltet auf diese um. Galerie und Ersatz-Titelbild der Website zeigen nur Fotos
der Wohnung des Bausteins und Fotos ohne Wohnung.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-29 18:40:13 +01:00

56 lines
2.1 KiB
PHP
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<?php
namespace App\Filament\Resources\Photos\Schemas;
use App\Enums\PhotoCategory;
use App\Models\Photo;
use App\Models\Property;
use App\Support\CurrentProperty;
use Filament\Forms\Components\Select;
use Filament\Forms\Components\SpatieMediaLibraryFileUpload;
use Filament\Forms\Components\TextInput;
use Filament\Forms\Components\Toggle;
use Filament\Schemas\Schema;
class PhotoForm
{
public static function configure(Schema $schema): Schema
{
return $schema
->columns(2)
->components([
SpatieMediaLibraryFileUpload::make('image')
->label('Bild')
->collection(Photo::COLLECTION)
->disk('public')
->image()
->imageEditor()
->maxSize(25 * 1024)
->helperText('JPG, PNG oder WebP bis 25 MB. Große Originale sind willkommen – Web-Größen werden automatisch erzeugt.')
->required()
->columnSpanFull(),
TextInput::make('alt_text')
->label('Bildbeschreibung')
->helperText('Kurz beschreiben, was zu sehen ist – wichtig für Google und für blinde Besucher.')
->required()
->maxLength(255),
TextInput::make('caption')
->label('Bildunterschrift (optional)')
->maxLength(255),
Select::make('category')
->label('Kategorie')
->options(PhotoCategory::class)
->default(PhotoCategory::Apartment)
->required(),
Select::make('property_id')
->label('Wohnung')
->options(fn (): array => Property::query()->pluck('name', 'id')->all())
->default(fn (): ?int => app(CurrentProperty::class)->id())
->placeholder('– keine (z. B. Umgebung) –'),
Toggle::make('is_published')
->label('Auf der Webseite zeigen')
->default(true),
]);
}
}