Import Action: Create or update on other table
Hello, I was trying to import the Students CSV file and it's working fine
and it has a relationship to Sections model.
How can I import the $data['section'] column to my
Sections model from resolveRecord()
or is there a right way to do that, TIA ❤️
6 Replies
Up
Is there a 'section_id' column on your students table?
im using the section_id as section_name
here's the table
you need an importer column like this
'''ImportColumn::make('section')
->requiredMapping()
->relationship(resolveUsing: ['name'])
'''
then in your csv file specify the name of the section in the relationship name column
will this create a record if the section is not existing on the table?
I will try it later, Thank you ❤️
No, it throw an error if it doesn't exist