Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

MahmoudAdelAli's avatar

Add Value To Input Filament

Hi , i have payment resource with first and last name but when i go to edit the record the full_name comes empty i tried to add ->default method but still empty

        Forms\Components\TextInput::make('first_name')
                            ->label(__('first_name'))
                            ->maxLength(255)
                            ->live()
                            ->afterStateUpdated(fn  (Forms\Set $set , ?string $state) => $set('full_name', $state)),

                        Forms\Components\TextInput::make('last_name')
                            ->label(__('last_name'))
                            ->maxLength(255)
                            ->live()
                            ->afterStateUpdated(fn  (Forms\Set $set , ?string $state) => $set('full_name', $state)),

                        Forms\Components\TextInput::make('full_name')
                            ->label(__('full_name'))
                        ->readOnly()
                            ->maxLength(255),

And here's the full_name

#Customer Model 
    public function fullName():Attribute
    {
        return Attribute::make(
            get: fn() => $this->firstname . ' ' . $this->lastname,
        );

    }
0 likes
0 replies

Please or to participate in this conversation.