Add Popular Routes
Curated from/to destination pairs for marketing content, editable via a Filament resource and served publicly (no auth, IP-throttled like CMS pages) through GET /api/v1/popular-routes. The API response trims each nested destination down to id/name/mm_name rather than the full catalog resource.
This commit is contained in:
+60
@@ -0,0 +1,60 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Routing\Filament\Resources\PopularRoutes\Tables;
|
||||
|
||||
use Filament\Actions\BulkActionGroup;
|
||||
use Filament\Actions\DeleteBulkAction;
|
||||
use Filament\Actions\EditAction;
|
||||
use Filament\Tables\Columns\IconColumn;
|
||||
use Filament\Tables\Columns\TextColumn;
|
||||
use Filament\Tables\Filters\SelectFilter;
|
||||
use Filament\Tables\Filters\TernaryFilter;
|
||||
use Filament\Tables\Table;
|
||||
|
||||
class PopularRoutesTable
|
||||
{
|
||||
public static function configure(Table $table): Table
|
||||
{
|
||||
return $table
|
||||
->columns([
|
||||
TextColumn::make('fromDestination.name')
|
||||
->label('From')
|
||||
->searchable()
|
||||
->sortable(),
|
||||
TextColumn::make('toDestination.name')
|
||||
->label('To')
|
||||
->searchable()
|
||||
->sortable(),
|
||||
TextColumn::make('description')
|
||||
->limit(50)
|
||||
->toggleable(isToggledHiddenByDefault: true),
|
||||
IconColumn::make('is_active')
|
||||
->boolean(),
|
||||
TextColumn::make('created_at')
|
||||
->dateTime()
|
||||
->sortable()
|
||||
->toggleable(isToggledHiddenByDefault: true),
|
||||
])
|
||||
->filters([
|
||||
SelectFilter::make('from_destination_id')
|
||||
->label('From')
|
||||
->relationship('fromDestination', 'name')
|
||||
->searchable()
|
||||
->preload(),
|
||||
SelectFilter::make('to_destination_id')
|
||||
->label('To')
|
||||
->relationship('toDestination', 'name')
|
||||
->searchable()
|
||||
->preload(),
|
||||
TernaryFilter::make('is_active'),
|
||||
])
|
||||
->recordActions([
|
||||
EditAction::make(),
|
||||
])
|
||||
->toolbarActions([
|
||||
BulkActionGroup::make([
|
||||
DeleteBulkAction::make(),
|
||||
]),
|
||||
]);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user