From ee1af56d03b6abd510f64d628fcac08ba23c2d0c Mon Sep 17 00:00:00 2001 From: Simon Date: Wed, 8 Oct 2025 16:31:23 +0200 Subject: [PATCH] Dokument popravljeni --- app/Http/Controllers/ClientCaseContoller.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/app/Http/Controllers/ClientCaseContoller.php b/app/Http/Controllers/ClientCaseContoller.php index 24f7c3f..2a0d4d4 100644 --- a/app/Http/Controllers/ClientCaseContoller.php +++ b/app/Http/Controllers/ClientCaseContoller.php @@ -1096,8 +1096,9 @@ public function show(ClientCase $clientCase) // Merge client case and contract documents into a single array and include contract reference when applicable $contractIds = $contracts->pluck('id'); + // Include 'uuid' so frontend can build document routes (was causing missing 'document' param error) $contractDocs = Document::query() - ->select(['id', 'documentable_id', 'documentable_type', 'name', 'file_name', 'original_name', 'extension', 'mime_type', 'size', 'created_at']) + ->select(['id', 'uuid', 'documentable_id', 'documentable_type', 'name', 'file_name', 'original_name', 'extension', 'mime_type', 'size', 'created_at']) ->where('documentable_type', Contract::class) ->when($contractIds->isNotEmpty(), fn ($q) => $q->whereIn('documentable_id', $contractIds)) ->orderByDesc('created_at') @@ -1112,7 +1113,7 @@ public function show(ClientCase $clientCase) }); $caseDocs = $case->documents() - ->select(['id', 'documentable_id', 'documentable_type', 'name', 'file_name', 'original_name', 'extension', 'mime_type', 'size', 'created_at']) + ->select(['id', 'uuid', 'documentable_id', 'documentable_type', 'name', 'file_name', 'original_name', 'extension', 'mime_type', 'size', 'created_at']) ->orderByDesc('created_at') ->limit(200) ->get()