Installation
importer section and run php artisan admin:migrate:
config/admin_helpers.php
Other keys of an import are allowed. Read them in your importer.
Importer class
app/Imports/ProductsImport.php
- Column keys are the headers of the file converted to lower case with underscores, e.g.
Product namebecomesproduct_name. formatcallsisValid{Format}($value, $row)of the importer. Rows with invalid values are listed in the error.castcallscast{Cast}($value)before the row is returned.- Empty cells are
null. - Override
validate(AdminModel $import)for checks of the whole file.
States and logs
Write your own log entries with
$import->logReport($type, $code, $message, $log), where $type is info, error or success. Log exceptions with $import->logException($e). The Show logs button of each import shows them.
Custom import model
ExtendAdminHelpers\Importer\Models\ImportsFile to change when files can be processed again:
app/Models/Import/ImportsFile.php
getImports(), getImporter(), canImport() and canProcess().
The type select of the form renders a ShowSampleImportFile component under the field. Create it in your component directory to offer a sample file.