tenant admin startseite schicker gestaltet und super-admin und tenant admin (filament) aufgesplittet.
Es gibt nun task collections und vordefinierte tasks für alle. Onboarding verfeinert und webseite-carousel gefixt (logging später entfernen!)
This commit is contained in:
48
app/Filament/Tenant/Widgets/RecentPhotosTable.php
Normal file
48
app/Filament/Tenant/Widgets/RecentPhotosTable.php
Normal file
@@ -0,0 +1,48 @@
|
||||
<?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);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user