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

[Bug] Multiple upload in a relationship does not work with Spatie/MediaLibrary #5625

Closed
manfield opened this issue Aug 19, 2024 · 1 comment

Comments

@manfield
Copy link

Bug report

What I did

While this code works properly on a CRUD form with a relation to a submodel:

        $this->crud->addField(
            [
                'label'     => "Content",
                'name'  => 'content_blocks',
                'type' => 'relationship',
                'subfields' => [
                    [
                        'name' => 'title',
                        'type' => 'text'
                    ],
                    [
                        'name' => 'text',
                        'type' => 'text'
                    ],
                    [
                        'name' => 'gallery',
                        'type' => 'upload_multiple',
                        'withFiles' => true
                    ],
                ],

            ]
        );

Screen.Recording.2024-08-19.at.13.46.12.mp4.mp4

What happens with Spatie/MediaLibary

using Spatie/MediaLibrary, like this - for example



      $this->crud->addField(
            [
                'label'     => "Content",
                'name'  => 'content_blocks',
                'type' => 'relationship',
                'subfields' => [
                    [
                        'name' => 'title',
                        'type' => 'text'
                    ],
                    [
                        'name' => 'text',
                        'type' => 'text'
                    ],
                    [
                        'name' => 'gallery',
                        'type' => 'upload_multiple',
                        'withMedia' => ['displayConversions' => 'thumbnail'],
                    ],
                ],

            ]
        );

brings to the following behaviour:

Screen.Recording.2024-08-19.at.13.50.09.mp4.mp4

What I expected to happen

Images are processed through the MediaLibrary as usually happens with an "image" type field

Backpack, Laravel, PHP, DB version

When I run php artisan backpack:version the output is:

### PHP VERSION:
8.3.9

### PHP EXTENSIONS:
Core, date, libxml, openssl, pcre, zlib, filter, hash, json, pcntl, random, Reflection, SPL, session, standard, sodium, mysqlnd, PDO, xml, ast, bcmath, calendar, ctype, curl, dom, mbstring, FFI, fileinfo, ftp, gd, gettext, iconv, igbinary, intl, exif, msgpack, mysqli, pdo_mysql, pdo_pgsql, pdo_sqlite, pgsql, Phar, posix, readline, redis, shmop, SimpleXML, sockets, sqlite3, sysvmsg, sysvsem, sysvshm, tokenizer, xmlreader, xmlwriter, xsl, zip, memcached, Zend OPcache, xdebug

### LARAVEL VERSION:
11.20.0.0

### BACKPACK PACKAGE VERSIONS:
backpack/basset: 1.3.5
backpack/crud: 6.7.25
backpack/devtools: 3.1.5
backpack/generators: v4.0.5
backpack/language-switcher: 2.0.0
backpack/medialibrary-uploaders: 1.2.0
backpack/permissionmanager: 7.2.1
backpack/pro: 2.2.12
backpack/theme-tabler: 1.2.11
backpack/translation-manager: 1.0.3
@karandatwani92
Copy link
Contributor

Hey @manfield

We are aware of the issue. A major refactoring of the Backpack Uploader is being done to cover this and other uploader-related problems. It's a BIG PR, which may take some time. Sorry for the inconvenience.

You can subscribe to our newsletter for the Backpack Progress report and other updates.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Done
Development

No branches or pull requests

2 participants