Laravel-Backpack / demo

A working demo of Laravel with all Backpack packages installed.
http://backpackforlaravel.com
Other
332 stars 165 forks source link

Add spatie media library to demo #456

Closed pxpm closed 1 year ago

pxpm commented 1 year ago

WHY

BEFORE - What was wrong? What was happening before this PR?

No working examples on how to use Spatie Media Library with our fields.

Installation steps: 1) You should do a composer update first to get media library installed, I already added it to composer.json 2) There is a new disk on filesystems.php along with links. If you are caching your configs, make sure to php artisan config:clear. 3) Migrations are added/modified, so do a php artisan migrate:fresh --seed 4) setup the folder link: php artisan storage:link

You should be good to go. Navigate to Products Crud, you should see something like: image

AFTER - What is happening after this PR?

We should now evaluate the steps taken to use Spatie Media Library and brainstorm a way to make developers life easier. I see there is a lot of "repetitive" work that we can automate.

pxpm commented 1 year ago

Note: we should review the final syntax so that I can update this branch with the correct definitions to work in demo.

tabacitu commented 1 year ago

Let's finish this PR to use the latest media syntax 💪

pxpm commented 1 year ago

@tabacitu testing notes.

This requires: https://github.com/Laravel-Backpack/CRUD/pull/4921

Everything should be configured in this PR, just don't forget to php artisan migrate, and clear configs in case you are caching them: php artisan config:clear.

This should work out-of-the-box! 🙏

tabacitu commented 1 year ago

I've just gone through this PR and "refreshed" it:

And I can confirm it is working WONDERFULLY:

CleanShot 2023-05-31 at 15 12 09@2x

There's only one thing I didn't do, that's preventing me from merging this is. We don't have a stopping mechanism for the online demo 👀 @pxpm could you please prevent people from actually uploading, when this is in production? We can probably bind/intercept all uploaders in production, to prevent the uploads... right?! 🤷‍♂️

pxpm commented 1 year ago

Thanks for moving this foward, was my next on line 🙏

We can probably bind/intercept all uploaders in production, to prevent the uploads... right?!

Will investigate the best course of action here.

pxpm commented 1 year ago

This is pending https://github.com/Laravel-Backpack/medialibrary-uploaders/pull/17

As soon as that gets merged I think we are good to go here.

@tabacitu can you give this a double check in the production constrains to don't upload files ?

Cheers

tabacitu commented 1 year ago

Tested, works, merging 🎉

Let's postpone the other 2 suggestions, they're COULDs/SHOULDs. Added issues for them for later in the year: