Frontend: - Connect MetroMap to live Inertia props (replace hardcoded demo data) - Drill-down navigation via router.visit for project-level maps - Reactive breadcrumb based on map level - Empty state when no projects exist - Reusable Modal component with retro styling - ProjectForm and CommitmentForm with Inertia useForm - FormInput reusable component (text, date, textarea, select) - FloatingActions FAB button for creating projects/themes Backend: - CommitmentService + CommitmentController (CRUD, mark complete, overdue) - DocumentService + DocumentController (upload, download, delete) - MapController now passes users and speerpunten to frontend - 7 new routes (4 commitment, 3 document) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
52 lines
1.3 KiB
PHP
52 lines
1.3 KiB
PHP
<?php
|
|
|
|
namespace App\Http\Controllers;
|
|
|
|
use App\Models\Document;
|
|
use App\Services\DocumentService;
|
|
use Illuminate\Http\Request;
|
|
use Illuminate\Support\Facades\Storage;
|
|
|
|
class DocumentController extends Controller
|
|
{
|
|
public function __construct(
|
|
private DocumentService $documentService
|
|
) {}
|
|
|
|
public function store(Request $request)
|
|
{
|
|
$validated = $request->validate([
|
|
'titel' => 'required|string|max:255',
|
|
'bestand' => 'required|file|max:20480',
|
|
'project_id' => 'required|exists:projects,id',
|
|
'fase_id' => 'nullable|exists:fases,id',
|
|
'type' => 'nullable|string|max:50',
|
|
]);
|
|
|
|
$this->documentService->upload($validated, $request->file('bestand'));
|
|
|
|
return back()->with('success', 'Document geupload.');
|
|
}
|
|
|
|
public function download(Document $document)
|
|
{
|
|
abort_unless(
|
|
Storage::disk('local')->exists($document->bestandspad),
|
|
404,
|
|
'Bestand niet gevonden.'
|
|
);
|
|
|
|
return Storage::disk('local')->download(
|
|
$document->bestandspad,
|
|
$document->titel
|
|
);
|
|
}
|
|
|
|
public function destroy(Document $document)
|
|
{
|
|
$this->documentService->delete($document);
|
|
|
|
return back()->with('success', 'Document verwijderd.');
|
|
}
|
|
}
|