diff --git a/Core.php b/Core.php index aa5424c..23e8d9a 100644 --- a/Core.php +++ b/Core.php @@ -15,6 +15,7 @@ use ArrayAccess\TrayDigita\App\Modules\Media\Entities\Attachment; use ArrayAccess\TrayDigita\App\Modules\Media\Entities\UserAttachment; use ArrayAccess\TrayDigita\App\Modules\Media\Media; +use ArrayAccess\TrayDigita\App\Modules\Posts\Posts; use ArrayAccess\TrayDigita\App\Modules\Users\Entities\Admin; use ArrayAccess\TrayDigita\App\Modules\Users\Entities\AdminLog; use ArrayAccess\TrayDigita\App\Modules\Users\Entities\AdminMeta; @@ -125,6 +126,7 @@ final class Core extends AbstractModule private array $requiredModules = [ Users::class, Media::class, + Posts::class ]; public function getName(): string @@ -161,8 +163,6 @@ protected function doInit(): void } Consolidation::registerAutoloader(__NAMESPACE__, __DIR__); $this->didInit = true; - $kernel = $this->getKernel(); - $kernel->registerControllerDirectory(__DIR__ .'/Controllers'); $this->getTranslator()?->registerDirectory('module', __DIR__ . '/Languages'); $this->getConnection()->registerEntityDirectory(__DIR__ . '/Entities'); diff --git a/SubModules/Service/Middlewares/InitMiddleware.php b/SubModules/Service/Middlewares/InitMiddleware.php index bfa7419..46d9269 100644 --- a/SubModules/Service/Middlewares/InitMiddleware.php +++ b/SubModules/Service/Middlewares/InitMiddleware.php @@ -137,6 +137,9 @@ static function ($response) use ($language) { $view = $this->serviceInitializer->core->getView(); $view->setRequest($request); $view->setParameter('language', $selectedLanguage); + + // add controller + $this->serviceInitializer->getKernel()->registerControllerDirectory(__DIR__ .'/../Controllers'); return $request; }