<?php

declare(strict_types=1);

namespace App\Filament\Components\Form;

use Filament\Forms\Components\Select;
use Illuminate\Support\Facades\Auth;

class SellerSelect extends Select
{
    public static function create(): static
    {
        return parent::make('seller_id')
            ->label('فروشنده')
            ->relationship('seller', 'name')
            ->getOptionLabelFromRecordUsing(fn ($record) => "{$record->name} - {$record->cellphone}")
            ->searchable(['name', 'cellphone'])
            ->preload()
            ->default(Auth::id())
            ->columnSpan(6);
    }
}
