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
Solution:
Does the Service model have id as primary key?
Jump to solution
2 Replies
Solution
Dennis Koch
Dennis Koch2mo ago
Does the Service model have id as primary key?
RHofmann
RHofmannOP2mo ago
🤦‍♂️ I'm using sushi and forgot to add it to the schema. Thank you very much
Want results from more Discord servers?
Add your server