RHofmann
RHofmann
FFilament
Created by RHofmann on 10/21/2024 in #❓┊help
Resource table action not being triggered
Hi, I've created a table within a resource and have a simple row action. When I click on the icon it spins but the action itself is never triggered. I'm not sure where I'm going wrong the file was created using php artisan make:filament-resource Service --simple --view
class ServiceResource extends Resource
{
public static function table(Table $table): Table
{
return $table
->columns([
TextColumn::make('state')
->formatStateUsing(fn (string $state): string => strtoupper($state))
->searchable()
->sortable()
->badge()
->color(fn (string $state): string => match ($state) {
'running' => 'success',
'stopped' => 'danger'
})
->weight('medium')
->alignLeft(),
])
->actions([
Action::make('test')
->icon('heroicon-o-play')
->color('success')
->action(function ($record) {
error_log('Action triggered');
\Log::info('Action triggered', [
'record' => $record->toArray(),
'state' => $record->state
]);
})
])
}
...
}
class ServiceResource extends Resource
{
public static function table(Table $table): Table
{
return $table
->columns([
TextColumn::make('state')
->formatStateUsing(fn (string $state): string => strtoupper($state))
->searchable()
->sortable()
->badge()
->color(fn (string $state): string => match ($state) {
'running' => 'success',
'stopped' => 'danger'
})
->weight('medium')
->alignLeft(),
])
->actions([
Action::make('test')
->icon('heroicon-o-play')
->color('success')
->action(function ($record) {
error_log('Action triggered');
\Log::info('Action triggered', [
'record' => $record->toArray(),
'state' => $record->state
]);
})
])
}
...
}
Thanks
5 replies