<?php

declare(strict_types=1);

namespace App\Filament\Components\Form;

use Filament\Forms\Components\TextInput;
use Illuminate\Support\Facades\Hash;

class PasswordTextInput extends TextInput
{
    public static function create(): static
    {
        return parent::make('password')
            ->label('رمز عبور')
            ->password()
            ->dehydrateStateUsing(fn ($state) => filled($state) ? Hash::make($state) : null)
            ->columnSpan(6);
    }
}
