-
Notifications
You must be signed in to change notification settings - Fork 903
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
Add withFiles()
functionality to CRUD fields
#4988
Conversation
[ci skip] [skip ci]
[ci skip] [skip ci]
[ci skip] [skip ci]
[ci skip] [skip ci]
[ci skip] [skip ci]
… into crud-uploads # Conflicts: # src/app/Library/Uploaders/Support/Interfaces/UploaderInterface.php
[ci skip] [skip ci]
[ci skip] [skip ci]
The inspection completed: 36 new issues, 77 updated code elements |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is much MUCH better Pedro! Only a few questions really, nothing important. This is GOOD TO GO! 🎉🎉🎉
|
||
class FileNameGenerator implements FileNameGeneratorInterface | ||
{ | ||
public function getName(string|UploadedFile $file): string |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmmm could/should we make this for()
to match the other one? And maybe it reads better? FileNameGenerator::for('somefile.txt')
- what do you think @pxpm?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree with this, let's dor it 💪
imageRequires manual validation (no laravel rules supplied to handle base64). One can use a package like https://github.com/crazybooot/base64-validation
Even using the package mentioned it cannot be used with regular laravel validation (eg. form requests), requiring custom validation to properly work. uploadNeed two separate validators, one for create and another for update.
use case: required
|
withUploads()
functionality to CRUD fields and columnswithFiles()
functionality to CRUD fields
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code review ✅ I'm ok with merging this as-is. My only (small) mention is that we might reconsinder some parameter names for temporary URLs - what I said in https://github.com/Laravel-Backpack/docs/pull/421/files
WHY
BEFORE - What was wrong? What was happening before this PR?
Managing uploads with backpack fields could be a challenge sometimes. Especially if we are talking about repeatable fields etc.
This PR aims to provide a tool to help developers setup their file uploads quicker ... well .. way way quicker 😄
AFTER - What is happening after this PR?
You should be able to get a fully working upload field in your crud with just:
Is it a breaking change?
No it's not! Fantastic!
How can we test the before & after?
Will write some docs later.