as per the documentation http://octobercms.com/docs/backend/import-export#custom-options,
we should be able to add a form yaml option in the config_import_export.htm for the export scenario.
when adding the form yaml options, the fields displays correctly in the export page, but when clik on 'export' we see a modal error showing the first field name defined the form yaml options
build 349
the content of my controllers/projects/config_import_export.yaml is
export:
title: Export Projects
fileName: export_projects_master.csv
list: $/smartbuild/asia/models/projectexport/columns.yaml
modelClass: smartbuild\asia\models\ProjectsExport
redirect: smartbuild/asia/projects/export
form: $/smartbuild/asia/models/projectexport/options.yaml
the content of my model/projectexport/options.yaml is
# ===================================
# Form Field Definitions
# ===================================
fields:
export_options_comment:
label: Help
type: partial
path: export_hint
export_from_record:
label: Export from record number
type: number
span: left
default: 1
export_until_record:
label: Export until record number
type: number
span: right
default: 5000
as a result after click on Export button, i see a modal window with 'export_from_record' inside and close button.
and nothing in the log
This is Laravel throwing a MassAssignmentException and the message contents just contains the field name, this is not helpful at all. This has been fixed so a more descriptive error is shown. eg:
Mass assignment failed for Model attribute 'export_from_record'.
To fix this, open your model class smartbuild\asia\models\ProjectsExport and ensure the attribute is "fillable". Either remove this:
/**
* @var array Guarded fields
*/
protected $guarded = ['*'];
Or add this
/**
* @var array Fillable fields
*/
protected $fillable = ['export_from_record'];
thanks @daftspunk , this solved the problem indeed
Cambiar a espa帽ol
Hello, I have problems with exporting. I need the file to export the data I select in the list but the model does not take that data from me, implement the filters with the scopes but never take them, they could help me
sorry for my English.
Most helpful comment
This is Laravel throwing a
MassAssignmentExceptionand the message contents just contains the field name, this is not helpful at all. This has been fixed so a more descriptive error is shown. eg:To fix this, open your model class
smartbuild\asia\models\ProjectsExportand ensure the attribute is "fillable". Either remove this:Or add this