<?php

declare(strict_types=1);

namespace App\Filament\Components\Form;

use App\Filament\Support\SelectOptionLabels;

use Filament\Forms\Components\Select;

class SubCategorySelect extends Select
{
    public static function create(): static
    {
        return parent::make('sub_category_id')
            ->label('زیردسته')
            ->relationship('subCategory', 'title')
            ->getOptionLabelFromRecordUsing(fn ($record) => SelectOptionLabels::category($record))
            ->searchable(['title'])
            ->preload()
            ->columnSpan(6);
    }
}

