ConnectionTest im Backend funktioniert jetzt

This commit is contained in:
2025-08-07 14:34:00 +02:00
parent 573661825b
commit ad893b48a7
21 changed files with 580 additions and 109 deletions

View File

@@ -27,47 +27,70 @@ class StyleResource extends Resource
public static function form(Form $form): Form
{
return $form
->columns('full')
->schema([
TextInput::make('title')
->label(__('filament.resource.style.form.title'))
->required()
->maxLength(255),
Toggle::make('enabled')
->label(__('filament.resource.style.form.enabled'))
->default(true),
Textarea::make('prompt')
->label(__('filament.resource.style.form.prompt'))
->required()
->rows(5),
Textarea::make('description')
->label(__('filament.resource.style.form.description'))
->required()
->rows(5),
FileUpload::make('preview_image')
->label(__('filament.resource.style.form.preview_image'))
->disk('public')
->directory('style_previews')
->image()
->imageEditor()
->required()
->rules(['mimes:jpeg,png,bmp,gif,webp']),
Textarea::make('parameters')
->label(__('filament.resource.style.form.parameters'))
->nullable()
->rows(15)
->json()
->helperText(__('filament.resource.style.form.parameters_help'))
->formatStateUsing(fn (?array $state): ?string => $state ? json_encode($state, JSON_PRETTY_PRINT) : null),
Select::make('ai_model_id')
->relationship('aiModel', 'name')
->label(__('filament.resource.style.form.ai_model'))
->required(),
Forms\Components\Tabs::make('Style Details')
->tabs([
Forms\Components\Tabs\Tab::make('General')
->schema([
Forms\Components\Grid::make(2)
->schema([
TextInput::make('title')
->label(__('filament.resource.style.form.title'))
->required()
->maxLength(255),
Toggle::make('enabled')
->label(__('filament.resource.style.form.enabled'))
->default(true),
]),
Forms\Components\Grid::make(2)
->schema([
Textarea::make('prompt')
->label(__('filament.resource.style.form.prompt'))
->required()
->rows(5),
Textarea::make('description')
->label(__('filament.resource.style.form.description'))
->required()
->rows(5),
]),
Select::make('ai_model_id')
->relationship('aiModel', 'name')
->label(__('filament.resource.style.form.ai_model'))
->required(),
FileUpload::make('preview_image')
->label(__('filament.resource.style.form.preview_image'))
->disk('public')
->directory('style_previews')
->image()
->imageEditor()
->required()
->rules(['mimes:jpeg,png,bmp,gif,webp']),
]),
Forms\Components\Tabs\Tab::make('Details')
->schema([
Forms\Components\TextInput::make('sort_order')
->numeric()
->default(0)
->label(__('filament.resource.style.form.sort_order')),
Textarea::make('parameters')
->label(__('filament.resource.style.form.parameters'))
->nullable()
->rows(15)
->json()
->helperText(__('filament.resource.style.form.parameters_help'))
->formatStateUsing(fn (?array $state): ?string => $state ? json_encode($state, JSON_PRETTY_PRINT) : null),
]),
]),
]);
}
public static function table(Table $table): Table
{
return $table
->defaultSort('sort_order')
->reorderable('sort_order')
->columns([
TextColumn::make('title')->label(__('filament.resource.style.table.title'))->searchable()->sortable(),
IconColumn::make('enabled')
@@ -75,6 +98,7 @@ class StyleResource extends Resource
->boolean(),
TextColumn::make('aiModel.name')->label(__('filament.resource.style.table.ai_model'))->searchable()->sortable(),
ImageColumn::make('preview_image')->label(__('filament.resource.style.table.preview_image'))->disk('public'),
TextColumn::make('sort_order')->label(__('filament.resource.style.table.sort_order'))->sortable(),
])
->filters([
SelectFilter::make('ai_model')