Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't working uploading images by using Image field #54

Open
AnderPirozhkov opened this issue Feb 7, 2020 · 5 comments
Open

Don't working uploading images by using Image field #54

AnderPirozhkov opened this issue Feb 7, 2020 · 5 comments

Comments

@AnderPirozhkov
Copy link

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
Copy link
Author

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

@suspendmode
Copy link

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

@kirschbaum
Copy link
Member

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

@genesiscz
Copy link
Contributor

@kirschbaum update?

@perzeli
Copy link

perzeli commented Nov 20, 2021

@kirschbaum is the problem solved ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants