© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
FilamentF
Filament•2y ago•
3 replies
Hapoo

How to trigger an action from a TextColumn

Hello, how can we trigger an action from a table column?

Here's my text column
Tables\Columns\TextColumn::make('status')
  ->translateLabel()
  ->badge()
  ->color(fn ($state) => $state->getColor())
  ->toggleable()
  ->sortable()
  ->searchable()->forceSearchCaseInsensitive()
  ->suffix(function ($state) {
      if ($state === Enums\ReservationStatus::READY) {
          return ' ('.__('Add booking review').')';
      }
  })
  ->action(function (Reservation $record, Table $table) {
      info(1);
  // how to trigger writeReview action
  }),
Tables\Columns\TextColumn::make('status')
  ->translateLabel()
  ->badge()
  ->color(fn ($state) => $state->getColor())
  ->toggleable()
  ->sortable()
  ->searchable()->forceSearchCaseInsensitive()
  ->suffix(function ($state) {
      if ($state === Enums\ReservationStatus::READY) {
          return ' ('.__('Add booking review').')';
      }
  })
  ->action(function (Reservation $record, Table $table) {
      info(1);
  // how to trigger writeReview action
  }),


And this is my action that I want to trigger
Tables\Actions\Action::make('writeReview')
  ->label(__('Booking review'))
  ->form([
      Forms\Components\TextInput::make('review.rating')
          ->translateLabel()
          ->minValue(1)
          ->maxValue(10)
          ->step(1)
          ->numeric()
          ->required()
          ->default(fn ($record) => $record->review?->rating),
      Forms\Components\Textarea::make('review.comment')
          ->translateLabel()
          ->default(fn ($record) => $record->review?->comment)
          ->helperText(fn ($record) => __(':name review', ['name' => $record->client?->name])),
  ])
  ->action(function (array $data, Reservation $record): void {
      $record->review()->updateOrCreate([], $data['review']);
  })
  ->hidden(true),
Tables\Actions\Action::make('writeReview')
  ->label(__('Booking review'))
  ->form([
      Forms\Components\TextInput::make('review.rating')
          ->translateLabel()
          ->minValue(1)
          ->maxValue(10)
          ->step(1)
          ->numeric()
          ->required()
          ->default(fn ($record) => $record->review?->rating),
      Forms\Components\Textarea::make('review.comment')
          ->translateLabel()
          ->default(fn ($record) => $record->review?->comment)
          ->helperText(fn ($record) => __(':name review', ['name' => $record->client?->name])),
  ])
  ->action(function (array $data, Reservation $record): void {
      $record->review()->updateOrCreate([], $data['review']);
  })
  ->hidden(true),
Solution
Found the answer
->action(function (Reservation $record, $livewire) {
      $livewire->mountTableAction('writeReview', $record->id);
}
->action(function (Reservation $record, $livewire) {
      $livewire->mountTableAction('writeReview', $record->id);
}
Jump to solution
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

How to trigger an action from another action?
FilamentFFilament / ❓┊help
14mo ago
How to trigger a form save from another action?
FilamentFFilament / ❓┊help
3y ago
Trigger action from javascript?
FilamentFFilament / ❓┊help
3y ago
How to dispatch an event from an Action
FilamentFFilament / ❓┊help
16mo ago