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

Handle uploads inside relationships #5243

Merged
merged 17 commits into from
Aug 11, 2023
Merged

Conversation

pxpm
Copy link
Contributor

@pxpm pxpm commented Jul 29, 2023

Uploaders didn't fully supported to be used inside relationships from the start.

I've now add that support, some relationships need some additional work from the developer that I documented here: Laravel-Backpack/docs#493

All other relation types shouldn't need any additional configuration from developer.

@jorgetwgroup I think this one needs an extra pair of eyes to make sure I didn't mess up. Can you help here with a review ?

I've used this branch https://github.com/Laravel-Backpack/demo/tree/test-relationship-uploaders that I created on demo to test.

We should test upload, image, upload_multiple and dropzone inside those relationships.

I haven't finish ALL tests, mainly I tested with upload field type, but I am going to test other field types this afternoon, and ping you here if I find something that caters your attention.

Cheers

pxpm and others added 2 commits July 28, 2023 23:22
@pxpm pxpm changed the title WIP: Handle uploads inside relationships Handle uploads inside relationships Aug 9, 2023
@jcastroa87
Copy link
Member

Hi @pxpm

im testing this on demo using in demo "SkillCrudController"

Set subfield

CRUD::field('pets')->subfields([
    ['name' => 'picture', 'type' => 'dropzone', 'withFiles' => ['path' => 'petfiles']],
]);

i add:

use \Backpack\Pro\Http\Controllers\Operations\DropzoneOperation;

but im always getting:

POST http://bpdemo.test/admin/skill/dropzone/upload 404 (Not Found)

and thats is because the real URL is:

http://bpdemo.test/admin/pet-shop/skill/dropzone/upload

because in the controller is set as:

CRUD::setRoute(config('backpack.base.route_prefix').'/pet-shop/skill');

I think we need to cover this scenario.

Cheers.

@pxpm
Copy link
Contributor Author

pxpm commented Aug 11, 2023

Hey @jorgetwgroup excelent catch! I totally missed it 🙏

I've submitted https://github.com/Laravel-Backpack/PRO/pull/200 to address the issue you reported, please confirm if it's ok to be merged 🙏

Apart from that, is this PR ready from your point of view ? If so I will clean up the code a bit, add some comments and ask @tabacitu for the final review 🙏

Thanks

@jcastroa87
Copy link
Member

Hi @pxpm

Everything is working now as expected.

I test, image, dropzone upload and upload_multiple inside relationships they work normal, and with https://github.com/Laravel-Backpack/PRO/pull/200 is fixed the dropzone bug.

For me look ready to merge.

Cheers.

@jcastroa87 jcastroa87 removed their assignment Aug 11, 2023
[ci skip] [skip ci]
@pxpm pxpm merged commit 31927e8 into main Aug 11, 2023
@pxpm pxpm deleted the handle-uploads-inside-relationships branch August 11, 2023 12:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

4 participants