nova-inline-relationship
nova-inline-relationship copied to clipboard
Don't working uploading images by using Image field
The image is not saved on the disk and, accordingly, the path to the database is not written. If you fill out a resource (which I want to add inline) from the sago resource editing form, then everything is fine, but when editing from a resource in which an inline is added, images / files are not saved. Resource that I fill
public function fields(Request $request)
{
return [
ID::make()->sortable(),
BelongsTo::make(__('nova::admin.project'), 'project', Project::class)->sortable(),
BelongsToMany::make(__('nova::admin.galleries'), 'galleries', Gallery::class)
->sortable(),
Select::make(__('nova::admin.locale'), 'locale')->options([
Settings::LANG_EN => __('nova::admin.lang_en'),
Settings::LANG_RU => __('nova::admin.lang_ru'),
]),
Text::make(__('nova::admin.name'), 'name')->sortable(),
Text::make(__('nova::admin.heading'), 'heading')->sortable(),
Text::make(__('nova::admin.subheader'), 'subheader')->sortable(),
NovaTinyMCE::make(__('nova::admin.description'), 'description')->options([
'base_url' => '/vendor/tinymce',
'plugins' => 'lists preview hr anchor pagebreak image wordcount fullscreen directionality paste textpattern autoresize addgallery link table',
'toolbar' => 'undo redo | styleselect | bold italic forecolor backcolor | alignleft aligncenter alignright alignjustify | image | bullist numlist outdent indent | link | table | addgallery',
'suffix' => '.min',
'use_lfm' => true,
]),
DuplicateField::make('Duplicate')->withMeta([
'resource' => 'project-translations', // resource url
'model' => \App\ProjectTranslation::class, // model path
'id' => $this->id, // id of record
'except' => ['locale'],
]),
MorphOne::make('MetaInformation', 'metas', MetaInformation::class)->inline()
->requireChild(),
];
}
The resource that I fill with the package:
public function fields(Request $request)
{
return [
ID::make()->sortable(),
MorphTo::make('imageable')->types([
ProjectTranslation::class,
PageTranslation::class,
]),
Text::make(__('nova::admin.meta_title'), 'title'),
Text::make(__('nova::admin.meta_description'), 'description'),
Text::make(__('nova::admin.meta_keywords'), 'keywords'),
Text::make(__('nova::admin.meta_robots'), 'robots'),
Text::make(__('nova::admin.og_title'), 'og_title'),
Text::make(__('nova::admin.og_description'), 'og_description'),
Image::make(__('nova::admin.og_image'), 'og_image')->disk('public'),
];
}
The problem, in my opinion, is that the value of the attribute name is not set for the image field
bump.
If db field name contains 3 parts separated with underscore like this:
only the last part stays in request:
What's more, if the file field is required the request returns with 422 status and a validation error:
We'll be looking into this shortly. Thanks for reporting the issue!
@kirschbaum update?
@kirschbaum is the problem solved ?