© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
FilamentF
Filament•6mo ago•
2 replies
CodeWithDennis

Pass the record to the importer class

I’m currently using the importer action in a relation manager. What’s the best way to pass the
ownerRecord
ownerRecord
to the importer and use it in
resolveRecord
resolveRecord
to set the relationship ID accordingly?

ImportAction::make('importSearchQueries')
    ->iconSize(IconSize::Small)
    ->label(__('Import'))
    ->importer(SearchQueriesImporter::class),
ImportAction::make('importSearchQueries')
    ->iconSize(IconSize::Small)
    ->label(__('Import'))
    ->importer(SearchQueriesImporter::class),


->firstOrCreate([
    'query' => $this->data['query'],
    // Retrieve the ownerRecord?
    'relation_id' => 1,
]);
->firstOrCreate([
    'query' => $this->data['query'],
    // Retrieve the ownerRecord?
    'relation_id' => 1,
]);
Solution
Here is how you can pass data to the importer:

ImportAction::make('importSearchQueries')
  ->importer(SearchQueriesImporter::class)
  ->options(['is_cool' => true])
ImportAction::make('importSearchQueries')
  ->importer(SearchQueriesImporter::class)
  ->options(['is_cool' => true])


You can then use the following in your importer file.

$this->options['is_cool']
$this->options['is_cool']
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

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

How to pass vlsue into Class importer
FilamentFFilament / ❓┊help
3y ago
Dynamic columns on Importer class
FilamentFFilament / ❓┊help
2y ago
Pass record to infolist from action
FilamentFFilament / ❓┊help
2y ago
Pass record to Relations Manager Modal
FilamentFFilament / ❓┊help
3y ago