app->singleton(WorkStructureRepository::class); $this->app->singleton(StructureRegistry::class); $this->app->singleton(MappingService::class); $this->app->singleton(WorkStructureService::class); } /** * Seed the built-in "Project" structure (idempotent). * * StructureRegistry::register() is cache-guarded and a no-op once the * structure exists, so this costs a cache read in steady state. Wrapped in * try/catch because the tables do not exist yet during a fresh install. */ public function boot(): void { try { /** @var StructureRegistry $registry */ $registry = $this->app->make(StructureRegistry::class); $registry->register( 'Project', 'system', [ ['typeKey' => 'milestone', 'label' => 'Milestone', 'domainReference' => 'Leantime\\Domain\\Tickets', 'sortOrder' => 1], ['typeKey' => 'task', 'label' => 'Task', 'domainReference' => 'Leantime\\Domain\\Tickets', 'sortOrder' => 2], ['typeKey' => 'goal', 'label' => 'Goal', 'domainReference' => 'Leantime\\Domain\\Goalcanvas', 'sortOrder' => 3], ], [ ['fromTypeKey' => 'task', 'toTypeKey' => 'milestone', 'relationshipType' => 'belongs_to'], ['fromTypeKey' => 'milestone', 'toTypeKey' => 'goal', 'relationshipType' => 'measures'], ] ); } catch (\Throwable $e) { // Tables may not exist yet during install/update — degrade gracefully. Log::debug('WorkStructure seed skipped: '.$e->getMessage()); } } }