© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
FilamentF
Filament•3y ago•
23 replies
bakriawad

Custom import job

Getting a serializable error when trying to import using a custom job:

Cannot initialize readonly property Filament\Actions\Imports\Jobs\ImportCsv::$importer from scope App\Jobs\ImportPatients
Cannot initialize readonly property Filament\Actions\Imports\Jobs\ImportCsv::$importer from scope App\Jobs\ImportPatients

(attached error message)

I am tryin to import patients, patients is a model that needs Users model to exists, where patient belongs to user

I have managed to create an import action, but that does not create the user with the patient, so I am resorting to creating an importer with a custom job
$table->headerActions([
                ImportAction::make()
                    ->importer(PatientImporter::class)
                    ->job(ImportPatients::class)
            ])
$table->headerActions([
                ImportAction::make()
                    ->importer(PatientImporter::class)
                    ->job(ImportPatients::class)
            ])


I can't figure out what's wrong, and there is no duocumentation on this.
Solution
if you want to create the relationship(user) along with the patient record, make use of the beforeSave hook
protected function beforeSave(): void
    {
//
}
protected function beforeSave(): void
    {
//
}
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

Import action trigger job after import
FilamentFFilament / ❓┊help
2y ago
import job failing continuously
FilamentFFilament / ❓┊help
2y ago
Import and Export Job Notifications
FilamentFFilament / ❓┊help
12mo ago
Problem with Import Action - Import job never completes
FilamentFFilament / ❓┊help
2y ago