© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
FilamentF
Filament•2y ago•
4 replies
hosmar27

Dynamically change Form component in Repeater

Just want to say that I'm not an expert in php or laravel or filament. Basically I'm doing a quiz, and I'm facing this issue where I want some of the questions to be toggle or just a textInput, this is my current code inside repeater (only the schema):

->schema(function ($record) {

                                $userCargoFormulario = DB::table('user_cargo_formulario as ucf')
                                    ->join('cargo_formulario as cf','ucf.cargo_formulario_id','=','cf.id')
                                    ->where('ucf.user_id', auth()->id())->get('tipo_id')->toArray();

                                    // dd($userCargoFormulario);

                                    if($userCargoFormulario[0]->tipo_id == 3){
                                        return TextInput::make('resposta');
                                    }
                            })
->schema(function ($record) {

                                $userCargoFormulario = DB::table('user_cargo_formulario as ucf')
                                    ->join('cargo_formulario as cf','ucf.cargo_formulario_id','=','cf.id')
                                    ->where('ucf.user_id', auth()->id())->get('tipo_id')->toArray();

                                    // dd($userCargoFormulario);

                                    if($userCargoFormulario[0]->tipo_id == 3){
                                        return TextInput::make('resposta');
                                    }
                            })



another example is that if(tipo_id == 3) should return toggle::make('resposta')
but this is the error returned:
Filament banner
FilamentJoin
A powerful open source UI framework for Laravel • Build and ship admin panels & apps fast with Livewire
20,307Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

Dynamically change defaultItems in Repeater
FilamentFFilament / ❓┊help
3y ago
How to dynamically fill repeater items in create form
FilamentFFilament / ❓┊help
3y ago
Dynamically disable form fields on variable change
FilamentFFilament / ❓┊help
2y ago