Files
innovatieplatform/app/Services/ThemaService.php
znetsixe d03fe15542 Sprint 1: Auth, metro map canvas, services, and retro UI
Authentication:
- Laravel Fortify + Sanctum with Inertia views
- RBAC middleware (admin, project_owner, team_member, viewer)
- Retro terminal-styled login/register/forgot-password pages

Metro Map (core UI):
- D3.js zoomable SVG canvas with metro line rendering
- Station nodes with glow-on-hover, status coloring, tooltips
- Breadcrumb navigation for multi-level drill-down
- Node preview panel with zoom-in action
- C64-style CLI bar with blinking cursor at bottom

Backend services:
- ProjectService (CRUD, phase transitions, park/stop, audit logging)
- ThemaService (CRUD with audit)
- MapDataService (strategy map L1, project map L2)
- Thin controllers: MapController, ProjectController, ThemaController
- 32 routes total (auth + app + API)

Style foundation:
- Retro-futurism theme: VT323, Press Start 2P, IBM Plex Mono fonts
- Dark palette with cyan/orange/green/purple neon accents
- Comprehensive seed data (4 themes, 12 projects, commitments, deps)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-01 13:52:35 +02:00

61 lines
1.5 KiB
PHP

<?php
namespace App\Services;
use App\Models\Thema;
use App\Models\AuditLog;
use Illuminate\Database\Eloquent\Collection;
use Illuminate\Support\Facades\Auth;
class ThemaService
{
public function getAll(): Collection
{
return Thema::with(['speerpunten.projects'])->get();
}
public function getForMap(): Collection
{
return Thema::with([
'speerpunten.projects' => function ($q) {
$q->with('eigenaar')
->withCount(['documents', 'commitments', 'risicos']);
}
])->get();
}
public function create(array $data): Thema
{
$thema = Thema::create([
'naam' => $data['naam'],
'beschrijving' => $data['beschrijving'] ?? '',
'prioriteit' => $data['prioriteit'] ?? \App\Enums\Prioriteit::Midden,
'periode_start' => $data['periode_start'] ?? null,
'periode_eind' => $data['periode_eind'] ?? null,
]);
AuditLog::create([
'user_id' => Auth::id(),
'action' => 'thema.created',
'entity_type' => 'thema',
'entity_id' => $thema->id,
]);
return $thema;
}
public function update(Thema $thema, array $data): Thema
{
$thema->update(array_filter($data, fn ($v) => $v !== null));
AuditLog::create([
'user_id' => Auth::id(),
'action' => 'thema.updated',
'entity_type' => 'thema',
'entity_id' => $thema->id,
]);
return $thema->fresh();
}
}