<?php

declare(strict_types=1);

namespace App\Filament\Components\Table;

use Filament\Tables\Columns\TextColumn;

class CategoriesTextColumn extends TextColumn
{
    public static function create(): static
    {
        return parent::make('categories')
            ->translateLabel()
            ->sortable()
            ->listWithLineBreaks()
            ->getStateUsing(fn ($record) => $record->categories->pluck('title'))
            ->toggleable();
    }
}
