<?php

declare(strict_types=1);

namespace App\Filament\Components\Form;

use App\Filament\Support\SelectOptionLabels;

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

class UpdateBySelect extends Select
{
    public static function create(): static
    {
        return parent::make('update_by')
            ->label('به‌روزرسانی توسط')
            ->relationship('updateBy', 'name')
            ->getOptionLabelFromRecordUsing(fn ($record) => SelectOptionLabels::user($record))
            ->searchable(['name', 'cellphone'])
            ->preload()
            ->default(Auth::id())
            ->hidden()
            ->columnSpan(6);
    }
}
