public static function table(Table $table): Table
{
return $table
->columns([
Tables\Columns\TextColumn::make('name')
->label(__('Name'))
->sortable()
->searchable(),
Tables\Columns\TextColumn::make('created_at')
->label(__('Created at'))
->dateTime()
->sortable()
->toggleable(isToggledHiddenByDefault: true),
Tables\Columns\TextColumn::make('updated_at')
->label(__('Updated at'))
->dateTime()
->sortable()
->toggleable(isToggledHiddenByDefault: true),
])
->filters([
//
])
->actions([
Tables\Actions\EditAction::make()
->mutateRecordDataUsing(function (array $data): array {
$data['platforms'] = ChannelPlatformFrequency::query()
->where('channel_id', request()->route('record'))
->get()
->mapWithKeys(fn ($channelPlatformFrequency) => [$channelPlatformFrequency->platform_id => $channelPlatformFrequency->platform->name])
->toArray();
return $data;
})
])
->bulkActions([
Tables\Actions\BulkActionGroup::make([
Tables\Actions\DeleteBulkAction::make(),
]),
]);
}