nova-inline-relationship icon indicating copy to clipboard operation
nova-inline-relationship copied to clipboard

Don't working uploading images by using Image field

Open AnderPirozhkov opened this issue 5 years ago • 5 comments

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'),
            ];
        }

AnderPirozhkov avatar Feb 07 '20 06:02 AnderPirozhkov

The problem, in my opinion, is that the value of the attribute name is not set for the image field image image

AnderPirozhkov avatar Feb 07 '20 08:02 AnderPirozhkov

bump.

If db field name contains 3 parts separated with underscore like this: image only the last part stays in request: image What's more, if the file field is required the request returns with 422 status and a validation error: image

suspendmode avatar Feb 07 '20 11:02 suspendmode

We'll be looking into this shortly. Thanks for reporting the issue!

kirschbaum avatar Feb 07 '20 14:02 kirschbaum

@kirschbaum update?

genesiscz avatar Apr 23 '20 22:04 genesiscz

@kirschbaum is the problem solved ?

perzeli avatar Nov 20 '21 10:11 perzeli