Files
fewo-stommer/app/Filament/Resources/Photos/Schemas/PhotoForm.php
T
Lars StommerandClaude Opus 5.5 bb7eb62782 Inhaltsverwaltung: Bilder, Webseiten-Texte, Ausstattung, FAQ, Hinweis-Banner
- Bilder mit automatischen WebP-Webgrößen (640/1280/2048 px), Sortierung per Drag & Drop, Mehrfach-Upload, Import-Befehl photos:import
- Webseiten-Texte als feste, bearbeitbare Bausteine (config/content.php), Rich-Text bereinigt ausgegeben
- Ausstattung und FAQ aus der bisherigen Webseite übernommen
- Rolle Inhalte hat Zugriff auf alle Webseiten-Bereiche

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-22 10:19:51 +02:00

54 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 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)
->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 => Property::query()->value('id'))
->placeholder('– keine (z. B. Umgebung) –'),
Toggle::make('is_published')
->label('Auf der Webseite zeigen')
->default(true),
]);
}
}