© 2026 Hedgehog Software, LLC

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

Adding Action Buttons to Custom Page for Form Navigation

Hello, how are you? I have this custom page where I would like to apply action buttons that will go to the form. But I don't know how to set up the HTML. I managed to put the table, and now I need a create action button to open the form.

   public function table(Table $table): Table
    {
         return $table
            ->query($this->tableQuery())
            ->columns([
                TextColumn::make('name')
                    ->searchable(),
                TextColumn::make('city.state.name')
                    ->toggleable(),

                TextColumn::make('city.name')
                    ->label('Cidade')
                    ->searchable(),

            ])
            ->filters([
                //
            ])
            ->actions([
                Action::make('select')
                    ->label(__('Gerenciar'))
                    ->icon('heroicon-o-academic-cap')
                    ->color('warning')
                    ->action(function ($record) {
                        if (request()->user()->isAdmin() || request()->user()->schools()->where('school_id', $record->id)->exists()) {
                            Cookie::queue('SHID', $record->code, 60 * 24 * 30);


                            Notification::make()
                                ->title("{$record->name}")
                                ->body("Você já pode gerenciar a escola!")
                                ->icon("heroicon-o-check-circle")
                                ->color("success")
                                ->send();

                            Redirect::to('/admin');
                        }
                    }),
            ], position: ActionsPosition::BeforeColumns);

    }

    public function form(Form $form): Form
    {
       // abstract
    }
   public function table(Table $table): Table
    {
         return $table
            ->query($this->tableQuery())
            ->columns([
                TextColumn::make('name')
                    ->searchable(),
                TextColumn::make('city.state.name')
                    ->toggleable(),

                TextColumn::make('city.name')
                    ->label('Cidade')
                    ->searchable(),

            ])
            ->filters([
                //
            ])
            ->actions([
                Action::make('select')
                    ->label(__('Gerenciar'))
                    ->icon('heroicon-o-academic-cap')
                    ->color('warning')
                    ->action(function ($record) {
                        if (request()->user()->isAdmin() || request()->user()->schools()->where('school_id', $record->id)->exists()) {
                            Cookie::queue('SHID', $record->code, 60 * 24 * 30);


                            Notification::make()
                                ->title("{$record->name}")
                                ->body("Você já pode gerenciar a escola!")
                                ->icon("heroicon-o-check-circle")
                                ->color("success")
                                ->send();

                            Redirect::to('/admin');
                        }
                    }),
            ], position: ActionsPosition::BeforeColumns);

    }

    public function form(Form $form): Form
    {
       // abstract
    }


<x-filament-panels::page>
  {{ $this->table}}
</x-filament-panels::page>
<x-filament-panels::page>
  {{ $this->table}}
</x-filament-panels::page>
image.png
Filament banner
FilamentJoin
A powerful open source UI framework for Laravel • Build and ship admin panels & apps fast with Livewire
20,307Members
Resources
Was this page helpful?

Similar Threads

Recent Announcements

Similar Threads

Adding Custom Page in Navigation
FilamentFFilament / ❓┊help
3y ago
Adding custom form action button
FilamentFFilament / ❓┊help
3y ago
Navigation for custom page
FilamentFFilament / ❓┊help
2y ago
Add action buttons to custom page with HasForms
FilamentFFilament / ❓┊help
3y ago