Files
fewo-stommer/app/Filament/Resources/Sites/Schemas/SiteForm.php
T
LarsandCursor 8ebc1a3878 Assign the existing site to one landlord so stommer.info can run tenancy.
Seebad 0.3 stays in this release. With a single landlord every host still reaches the default website.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-10-23 12:00:11 +02:00

57 lines
2.7 KiB
PHP

<?php
namespace App\Filament\Resources\Sites\Schemas;
use App\Filament\Resources\Appearances\Schemas\AppearanceForm;
use App\Models\Site;
use App\Themes\ThemeRegistry;
use Filament\Actions\Action;
use Filament\Forms\Components\Select;
use Filament\Forms\Components\TextInput;
use Filament\Forms\Components\Toggle;
use Filament\Schemas\Components\Section;
use Filament\Schemas\Components\Utilities\Get;
use Filament\Schemas\Schema;
use Illuminate\Support\Facades\URL;
class SiteForm
{
public static function configure(Schema $schema): Schema
{
return $schema
->columns(2)
->components([
Section::make('Website')
->columns(2)
->schema([
TextInput::make('name')->label('Name')->required()->maxLength(120),
TextInput::make('domain')
->label('Domain')
->placeholder('www.fewo-stommer.de')
->helperText('Leer = Standard-Website, solange es nur diesen Mandanten gibt. Ab dem zweiten Mandanten antwortet nur eine eingetragene Domain.')
->unique(ignoreRecord: true)
->maxLength(190),
Select::make('theme')
->label('Theme')
->options(fn (): array => app(ThemeRegistry::class)->options())
->default(config('themes.base'))
->required()
->live()
->helperText(fn (Get $get): ?string => filled($get('theme')) ? app(ThemeRegistry::class)->get($get('theme'))->description : null)
->hintAction(
Action::make('previewTheme')
->label('Vorschau')
->icon('heroicon-o-eye')
->url(fn (Get $get): string => URL::temporarySignedRoute('home', now()->addDay(), ['theme' => $get('theme') ?: config('themes.base')]), shouldOpenInNewTab: true),
),
Toggle::make('is_default')->label('Standard-Website')->inline(false),
]),
Section::make('Farben des Themes')
->description('Grundfarben dieser Website; saisonale Erscheinungsbilder können einzelne Farben zusätzlich ändern.')
->columns(3)
->collapsible()
->schema(fn (Get $get, ?Site $record): array => AppearanceForm::tokenFields($record?->id, 'theme_settings.tokens', $get('theme'))),
]);
}
}