© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
FilamentF
Filament•3y ago•
1 reply
Auceptin

Using query params while working with actions

i have the following code, i'm passing url params to the create page, to either show/hide inputs in the form, but the generate action is making the input dissapear
is there a better way to do this
Forms\Components\Section::make()
      ->schema([
          Forms\Components\TextInput::make('code')
              ->label('Coupon code')
              ->suffixAction(
                                                                  Forms\Components\Actions\Action::make('generate')
            ->label('Generate')
            ->color('gray')
            ->link()
            ->icon('heroicon-o-cog-8-tooth')
            ->action(function (Set $set) {
                $set('code',  strtoupper(Str::random(12)));
                                            })
                                    )
                                    ->visible(fn() => request()->get('type') === 'coupon' ? true : false)
                                    ->hint('Customers will enter this coupon code when they checkout.'),

                                Forms\Components\TextInput::make('promotionName')
                                    ->placeholder('Enter promotion name')
                                    ->visible(fn() => request()->get('type') === 'promotion' ? true : false),
                            ]),
Forms\Components\Section::make()
      ->schema([
          Forms\Components\TextInput::make('code')
              ->label('Coupon code')
              ->suffixAction(
                                                                  Forms\Components\Actions\Action::make('generate')
            ->label('Generate')
            ->color('gray')
            ->link()
            ->icon('heroicon-o-cog-8-tooth')
            ->action(function (Set $set) {
                $set('code',  strtoupper(Str::random(12)));
                                            })
                                    )
                                    ->visible(fn() => request()->get('type') === 'coupon' ? true : false)
                                    ->hint('Customers will enter this coupon code when they checkout.'),

                                Forms\Components\TextInput::make('promotionName')
                                    ->placeholder('Enter promotion name')
                                    ->visible(fn() => request()->get('type') === 'promotion' ? true : false),
                            ]),
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

`null` query params
FilamentFFilament / ❓┊help
3y ago
Table with Records (no Query) crashes while using summarize
FilamentFFilament / ❓┊help
5mo ago
Disable table actions while searching
FilamentFFilament / ❓┊help
2y ago
Modify Query Using with Live
FilamentFFilament / ❓┊help
11mo ago