From 8c1cb02c588f3a0a7b8c5d3a7d7a7ce655f3d076 Mon Sep 17 00:00:00 2001 From: Michal Feher Date: Thu, 5 Feb 2026 15:19:49 +0100 Subject: [PATCH] no message --- be/app/Http/Controllers/SubTaskController.php | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/be/app/Http/Controllers/SubTaskController.php b/be/app/Http/Controllers/SubTaskController.php index a9c24ed..96eecf1 100644 --- a/be/app/Http/Controllers/SubTaskController.php +++ b/be/app/Http/Controllers/SubTaskController.php @@ -496,6 +496,12 @@ class SubTaskController extends Controller $description = $requestData['description'] ?? $draft->description; $deadline = $requestData['deadline'] ?? $draft->deadline; + // Najprv nahráme nové súbory z requestu (ak existujú) + $newAttachments = []; + if ($request->file('data') && isset($request->file('data')['files'])) { + $newAttachments = Attachment::uploadAttachmentsToS3($request->file('data')['files'], $mastertask); + } + // Vytvoríme subtask pre každého zamestnanca foreach ($employees as $employee) { $subtaskData = [ @@ -534,6 +540,11 @@ class SubTaskController extends Controller ]); } + // Pridáme nové attachmenty z requestu + if (! empty($newAttachments)) { + $newSubtask->attachments()->createMany($newAttachments); + } + $createdSubtasks[] = $newSubtask; }