Paltzhalter

This commit is contained in:
salam committed 2025-10-17 14:03:30 +02:00
1 parent 44da4addcd
commit d1ce891d9c
10 files changed
+205 -47

No files matched your search

@@ -0,0 +1,66 @@
<?php
namespace App\Filament\Resources\Projektes\RelationManagers;
use App\Actions\Create\CreatePlatzhalter;
use Filament\Actions\Action;
use Filament\Actions\EditAction;
use Filament\Forms\Components\TextInput;
use Filament\Resources\RelationManagers\RelationManager;
use Filament\Schemas\Schema;
use Filament\Tables\Columns\TextColumn;
use Filament\Tables\Columns\TextInputColumn;
use Filament\Tables\Table;
class ProjektPlatzhalterRelationManager extends RelationManager
{
protected static string $relationship = 'projekt_platzhalters';
protected static ?string $title = 'Platzhalter';
protected static ?string $navigationLabel = 'Platzhalter';
protected static ?string $modelLabel = 'Platzhalter';
protected static ?string $pluralModelLabel = 'Platzhalter';
public function form(Schema $schema): Schema
{
return $schema
->components([
TextInput::make('platzhalter')
->required()
->maxLength(255),
TextInput::make('platzhaltertext')
->required()
->maxLength(255),
]);
}
public function table(Table $table): Table
{
return $table
->recordTitleAttribute('name')
->columns([
TextColumn::make('platzhalter')
->searchable(),
TextInputColumn::make('platzhaltertext')
->label('Platzhalter Text')
->searchable(),
])
->headerActions([
Action::make('generate')
->action(fn (CreatePlatzhalter $createPlatzhalter) => $createPlatzhalter->create($this->ownerRecord))
->requiresConfirmation()
->modalHeading('Platzhalter neu generieren')
->modalDescription('Bestehende Platzhalter bleiben erhalten, neue werden hinzugefügt und nicht mehr verwendete werden gelöscht.')
->modalSubmitActionLabel('Ja, neu generieren')
->label('Generieren')
->tooltip('Platzhalter werden neu eingelesen.')
->icon('heroicon-o-cog-8-tooth'),
])
->recordActions([
// EditAction::make()->iconButton()->color('gray'),
]);
}
}