From 9780903b9e4c39b568882f11d4fde33701132f11 Mon Sep 17 00:00:00 2001 From: AJ <60591772+devajmeireles@users.noreply.github.com> Date: Fri, 26 Jan 2024 11:55:34 -0300 Subject: [PATCH] enhancements on upload doc --- app/Enums/Examples/Form/Upload.php | 38 ++++++++++++++++--- .../views/documentation/form/upload.blade.php | 5 --- 2 files changed, 33 insertions(+), 10 deletions(-) diff --git a/app/Enums/Examples/Form/Upload.php b/app/Enums/Examples/Form/Upload.php index 17642865..dd0eab2d 100644 --- a/app/Enums/Examples/Form/Upload.php +++ b/app/Enums/Examples/Form/Upload.php @@ -30,6 +30,18 @@ class Upload public function deleteUpload(array $content): void { + /* + the $content contains: + [ + 'temporary_name', + 'real_name', + 'extension', + 'size', + 'path', + 'url', + ] + */ + if (! $this->photo) { return; } @@ -163,6 +175,10 @@ public function mount(): void 'path' => $file->getPath(), 'url' => Storage::url('images/'.$file->getFilename()), ])->toArray(); + + // In this example we are using the images that exists + // in the application server, but you can use any other + // files for example, files that are stored in the S3 bucket. } // ... @@ -170,11 +186,11 @@ public function mount(): void HTML; public const BLADE_COMPONENT_FOR_STATIC_USAGE = <<<'HTML' - + events (only remove event) + renaming delete method --> @@ -182,9 +198,9 @@ public function mount(): void - + HTML; @@ -195,6 +211,18 @@ public function mount(): void public function deleteUpload(array $content): void { + /* + the $content contains: + [ + 'temporary_name', + 'real_name', // same of 'temporary_name' in static mode + 'extension', + 'size', + 'path', + 'url', + ] + */ + if (empty($this->photos)) { return; } diff --git a/resources/views/documentation/form/upload.blade.php b/resources/views/documentation/form/upload.blade.php index 36bd558c..fbcf333f 100644 --- a/resources/views/documentation/form/upload.blade.php +++ b/resources/views/documentation/form/upload.blade.php @@ -110,11 +110,6 @@ -

- Keep in mind that in all this example we use existing images in the application, - however you can bring your existing images, for example, on S3. The code is - yours, you can do whatever you want. -