Files
fotospiel-app/app/Filament/Widgets/RecentPhotosTable.php
SEB Fotografie - soeren fc1e64fea3 feat(profile): add username + preferred_locale; wire to Inertia + middleware
- DB: users.username (unique), users.preferred_locale (default from app.locale)
- Backend: validation, model fillable; share supportedLocales; SetLocaleFromUser
- Frontend: profile page fields + types
- Filament: SuperAdmin profile page with username/language

feat(admin-nav): move Tasks to Bibliothek and add menu labels

fix(tasks-table): show localized title/emotion/event type; add translated headers

feat(l10n): add missing table headers for emotions and event types; normalize en/de files

refactor: tidy translations for tasks/emotions/event types
2025-09-11 21:17:19 +02:00

49 lines
1.8 KiB
PHP

<?php
namespace App\Filament\Widgets;
use Filament\Tables;
use Filament\Widgets\TableWidget as BaseWidget;
use App\Models\Photo;
use Filament\Actions;
class RecentPhotosTable extends BaseWidget
{
protected static ?string $heading = null;
public function getHeading()
{
return __('admin.widgets.recent_uploads.heading');
}
protected int|string|array $columnSpan = 'full';
public function table(Tables\Table $table): Tables\Table
{
return $table
->query(
Photo::query()
->orderByDesc('created_at')
->limit(10)
)
->columns([
Tables\Columns\ImageColumn::make('thumbnail_path')->label(__('admin.common.thumb'))->circular(),
Tables\Columns\TextColumn::make('id')->label(__('admin.common.hash')),
Tables\Columns\TextColumn::make('event_id')->label(__('admin.common.event')),
Tables\Columns\TextColumn::make('likes_count')->label(__('admin.common.likes')),
Tables\Columns\TextColumn::make('created_at')->since(),
])
->actions([
Actions\Action::make('feature')
->label(__('admin.photos.actions.feature'))
->visible(fn(Photo $record) => ! (bool)($record->is_featured ?? 0))
->action(fn(Photo $record) => $record->update(['is_featured' => 1])),
Actions\Action::make('unfeature')
->label(__('admin.photos.actions.unfeature'))
->visible(fn(Photo $record) => (bool)($record->is_featured ?? 0))
->action(fn(Photo $record) => $record->update(['is_featured' => 0])),
])
->paginated(false);
}
}