how to pass parent record to relation manager bulkaction

I have this bulk action in a relationmanager:

I want to pass, alongside the $records, the parent record. how can I do that?
BulkAction::make('Marquer comme réussi')
  ->color('info')
  ->deselectRecordsAfterCompletion()
  ->visible()
  ->action(function ($records) {
      foreach ($records as $record) {
           $record->update(['cert_code' => bin2hex(random_bytes(4))]);
       }
})
Was this page helpful?