File tree Expand file tree Collapse file tree 2 files changed +19
-0
lines changed
Expand file tree Collapse file tree 2 files changed +19
-0
lines changed Original file line number Diff line number Diff line change @@ -32,6 +32,9 @@ public function register(): void
3232 $ this ->app ->singleton (ModuleService::class, fn ($ app ): ModuleService
3333 => new ModuleService ($ app ->make (ManifestBuilder::class)));
3434
35+ // Bind 'modules' alias for app('modules') access
36+ $ this ->app ->alias (ModuleService::class, 'modules ' );
37+
3538 // Don't register autoloading here - defer to boot phase
3639 }
3740
Original file line number Diff line number Diff line change @@ -51,6 +51,22 @@ public function find(string $name): ?array
5151 return $ modules [$ name ] ?? null ;
5252 }
5353
54+ /**
55+ * Get a specific module by name or throw an exception if not found
56+ *
57+ * @throws \InvalidArgumentException
58+ */
59+ public function findOrFail (string $ name ): array
60+ {
61+ $ module = $ this ->find ($ name );
62+
63+ if (null === $ module ) {
64+ throw new \InvalidArgumentException ("Module ' {$ name }' not found. " );
65+ }
66+
67+ return $ module ;
68+ }
69+
5470 /**
5571 * Check if a module exists and is enabled
5672 */
You can’t perform that action at this time.
0 commit comments