From 02622aa38f0a8077d5303ab786830c15165fef80 Mon Sep 17 00:00:00 2001 From: ArrayIterator Date: Mon, 11 Mar 2024 16:17:50 +0700 Subject: [PATCH] add posts & patch --- Core.php | 4 ++-- SubModules/Service/Middlewares/InitMiddleware.php | 3 +++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/Core.php b/Core.php index 21efaa3..a27eb60 100644 --- a/Core.php +++ b/Core.php @@ -14,6 +14,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; @@ -128,6 +129,7 @@ final class Core extends AbstractModule private array $requiredModules = [ Users::class, Media::class, + Posts::class ]; public function getName(): string @@ -163,8 +165,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; }