Es gibt nun task collections und vordefinierte tasks für alle. Onboarding verfeinert und webseite-carousel gefixt (logging später entfernen!)
49 lines
1.8 KiB
PHP
49 lines
1.8 KiB
PHP
<?php
|
|
|
|
namespace App\Filament\Tenant\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);
|
|
}
|
|
}
|
|
|