FilamentF
Filament3y ago
Kaan

Catch data from fill

Hello. I am trying to trigger the fill state by triggering the visible property and capturing the type of the current data while filling the data in Filament, but I could not succeed.
Here is my code:
All Code:
https://gist.github.com/kaanxweb/b7aace76adec07d1dbd7c1d052af6676
Form Method:
    public function form(Form $form): Form
    {
        return $form
            ->schema([
                Repeater::make('categorySteps')
                    ->label($this->categoryApplicationName . ' Adımı')
                    ->schema([
                        TextInput::make('step_title')
                            ->label('Adım Başlığı')
                            ->disabled()
                            ->required(),

                        FileUpload::make('file_name')
                            ->label('Dosya Yükleyin')
                            ->disk('public')
                            ->directory('category-application-steps')
                            ->acceptedFileTypes(['application/pdf'])
                            ->visible(fn(mixed $value): bool => dd($value))
                            ->required(),

                        TextInput::make('file_description')
                            ->label('Dosya Açıklaması')
                            ->required(),

                        Checkbox::make('is_approved')
                            ->label('Dikkatlice Okudum ve Onaylıyorum')
                            ->accepted()
                    ])
                    ->deletable(false)
                    ->addable(false)
                    ->reorderable()
                    ->columns(1),
            ])
            ->statePath('data')
            ->columns(1);
    }
Solution
 ->visible(fn(callable $get) => $get('type') == 'upload')

Solved this problem with callable method.
Was this page helpful?