Custom action in relation manager
Hello - is it possible to pass a parameter in a custom action in a relation manager table?
I can use a custom action without a parameter. When I add the record ID as a parameter I see two requests but neither one seems to work
public static function table(Table $table): Table
{
return $table
->columns([
Tables\Columns\TextColumn::make('item.name'),
Tables\Columns\TextColumn::make('qty')
->label('Quantity'),
])
->filters([
//
])
->headerActions([
// Tables\Actions\CreateAction::make(),
])
->actions([
// Tables\Actions\EditAction::make(),
// Tables\Actions\DeleteAction::make(),
Tables\Actions\Action::make('refundItem')
->label('Refund Item')
->action(function($record) {
return "refundItem($record->id)";
})
])
->bulkActions([
// Tables\Actions\DeleteBulkAction::make(),
]);
}
public function refundItem($selectionId)
{
dd($selectionId);
}public static function table(Table $table): Table
{
return $table
->columns([
Tables\Columns\TextColumn::make('item.name'),
Tables\Columns\TextColumn::make('qty')
->label('Quantity'),
])
->filters([
//
])
->headerActions([
// Tables\Actions\CreateAction::make(),
])
->actions([
// Tables\Actions\EditAction::make(),
// Tables\Actions\DeleteAction::make(),
Tables\Actions\Action::make('refundItem')
->label('Refund Item')
->action(function($record) {
return "refundItem($record->id)";
})
])
->bulkActions([
// Tables\Actions\DeleteBulkAction::make(),
]);
}
public function refundItem($selectionId)
{
dd($selectionId);
}I can use a custom action without a parameter. When I add the record ID as a parameter I see two requests but neither one seems to work