FilamentF
Filament3y ago
Kaan

Fill Form Data

Greetings!
I want to perform an edit operation on my custom page I created in Filament. However, since this edit operation will be with data from a relational table, I have some difficulty in bringing the data.
If I need to talk about logic briefly:
There is "category_id" in categorySteps. Every data that has this "category_id" comes from the category_steps table. What I want to do here is to call the step_title of the data in the category_steps table associated with this category_id

https://hastebin.skyra.pw/ezupekilon.php
Solution
add $data and statePath
public ?array $data = [];

public function form(Form $form): Form
{
    return $form
        ->schema([
            Repeater::make('categorySteps')
                ->label('Category Steps')
                ->schema([
                    TextInput::make('step_title')
                        ->required(),
                ])
                ->columns(2)
        ])
        ->columns(1)
        ->statePath('data');
}
Was this page helpful?