Replies: 3 comments
-
This looks alot like uploaders https://backpackforlaravel.com/docs/6.x/crud-uploaders#about have you checked them ? |
Beta Was this translation helpful? Give feedback.
-
Hi @pxpm, I know about uploaders, i also mentioned this in the post, please review the post one more time.
Cheers! |
Beta Was this translation helpful? Give feedback.
-
Hey @susanu sorry I probably missed that bit. I've read it better now.
This was not contemplated in uploaders, probably we can add a
This is very dependent on the setup. Indeed, if you are only going to generate your path after the model is saved, it makes sense to not store it in the database, otherwise you would need two queries. But mostly I agree with this. I like the idea of the casts you presented. We can use them to define the only things that makes sense to define in the model (the path and the disk), and we use it in our uploaders retrieve event. We miss the ability to define the This may be a good idea, depending on how we frame it. Thanks a lot for the example code 👍 |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi guys,
In backpack v5 i implemented a file management to make uploads easier.
The way it works is like this:
File
file_upload
which is just a wrapper for theupload
field but supports thisFile
class.file
which displays a link to the file.This system does not update, upload or delete the files if the model throws an error when saving.
IMPORTANT: All of my files are stored in a
s3
disk and the paths look like this:{model_class}/{id}/{?attribute}/{filename}
Path examples (please note that path include the model id which helps me find everything related to that model in 1 folder):
I propose something similar for the next version of backpack, i know you implemented uploaders but controlling everything from one place would be a nice addition.
Let me know if you like any of the ideas presented here so we can start building.
Source files (please keep in mind that these are oriented towards my use cases and need to be adjusted):
file_upload
fieldfile
columnBeta Was this translation helpful? Give feedback.
All reactions