Stelle das U0-Fundament mit CMS, Mitgliedern und Filament bereit.
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
1 parent
89b35ac480
commit
2035c46edd
130 files changed
+18519
-50
No files matched your search
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\Pages\RelationManagers;
|
||||
|
||||
use App\Domain\Cms\PageRevision;
|
||||
use App\Domain\Cms\PageService;
|
||||
use Filament\Actions\Action;
|
||||
use Filament\Resources\RelationManagers\RelationManager;
|
||||
use Filament\Tables\Columns\TextColumn;
|
||||
use Filament\Tables\Table;
|
||||
|
||||
class RevisionsRelationManager extends RelationManager
|
||||
{
|
||||
protected static string $relationship = 'revisions';
|
||||
|
||||
protected static ?string $title = 'Revisionen';
|
||||
|
||||
public function table(Table $table): Table
|
||||
{
|
||||
return $table
|
||||
->columns([
|
||||
TextColumn::make('id')->label('Nr.'),
|
||||
TextColumn::make('created_at')->label('Gespeichert')->dateTime('d.m.Y H:i'),
|
||||
TextColumn::make('author.name')->label('Von'),
|
||||
TextColumn::make('published')
|
||||
->label('Live')
|
||||
->state(fn (PageRevision $record): string => $record->id === $this->getOwnerRecord()->published_revision_id ? 'Ja' : 'Nein'),
|
||||
])
|
||||
->recordActions([
|
||||
Action::make('publish')
|
||||
->label('Veröffentlichen')
|
||||
->requiresConfirmation()
|
||||
->visible(fn (): bool => auth()->user()?->can('publish', $this->getOwnerRecord()) ?? false)
|
||||
->action(function (PageRevision $record, PageService $service): void {
|
||||
$service->publish($this->getOwnerRecord(), $record);
|
||||
$this->getOwnerRecord()->refresh();
|
||||
}),
|
||||
Action::make('restore')
|
||||
->label('Wiederherstellen')
|
||||
->requiresConfirmation()
|
||||
->modalDescription('Es entsteht eine neue Revision. Die Live-Seite bleibt unverändert, bis sie veröffentlicht wird.')
|
||||
->action(function (PageRevision $record, PageService $service): void {
|
||||
$service->restore($this->getOwnerRecord(), $record, auth()->user());
|
||||
}),
|
||||
])
|
||||
->defaultSort('id', 'desc');
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user