This forum has moved to a new location and is in read-only mode. Please visit talk.octobercms.com to access the new location.
Hello. I'm trying to add an import\export feature to my plugin. I followed this guide: https://octobercms.com/docs/backend/import-export Export works fine, but when i try to import same file or new, it throws an error listing all rows in the file. Message next to row number contains just column name. There is no any specific errors, how do i find the source of this problem? Thanks.
I found the solution! https://stackoverflow.com/questions/46969131/laravel-5-5-massassignmentexception
Last updated
add the following text to your class:
public function importData($results, $sessionKey = null)
{
Subscriber::unguard();
foreach ($results as $row => $data) {
try {
$subscriber = new Subscriber;
$subscriber->fill($data);
$subscriber->save();
$this->logCreated();
}
catch (\Exception $ex) {
$this->logError($row, $ex->getMessage());
}
}
Subscriber::reguard();
}
}
this example based to https://octobercms.com/docs/backend/import-export
Last updated
1-4 of 4