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);
}
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:
Solved this problem with callable method....Jump to solution
->visible(fn(callable $get) => $get('type') == 'upload')
->visible(fn(callable $get) => $get('type') == 'upload')
1 Reply
Solution
Solved this problem with callable method.
->visible(fn(callable $get) => $get('type') == 'upload')
->visible(fn(callable $get) => $get('type') == 'upload')