Pre-fill support for file input (#222)

Co-authored-by: Julien Nahum <julien@nahum.net>
This commit is contained in:
formsdev
2023-10-20 14:30:35 +05:30
committed by GitHub
parent c470791282
commit 4614dc0f18
6 changed files with 63 additions and 17 deletions

View File

@@ -40,6 +40,11 @@ class StorageFile implements Rule
*/
public function passes($attribute, $value): bool
{
// If full path then no need to validate
if (filter_var($value, FILTER_VALIDATE_URL) !== FALSE) {
return true;
}
// This is use when updating a record, and file uploads aren't changed.
if($this->form){
$newPath = Str::of(PublicFormController::FILE_UPLOAD_PATH)->replace('?', $this->form->id);