diff --git a/app/Config/Routes.php b/app/Config/Routes.php index baf8ed7..e6239d9 100644 --- a/app/Config/Routes.php +++ b/app/Config/Routes.php @@ -18,10 +18,11 @@ $routes->group('cli', ['namespace' => 'App\Controllers\CLI'], function ($routes) }); $routes->group('', ['namespace' => 'App\Controllers\Front'], function ($routes) { - $routes->get('/', 'WelcomeController::index'); - $routes->group('inquiry', function ($routes) { - $routes->post('create', 'InquiryController::create'); - }); + $routes->get('/', 'PageController::index'); + $routes->get('about-us', 'PageController::about-us'); + $routes->get('products', 'PageController::products'); + $routes->get('logistics-services', 'PageController::logistics_services'); + $routes->get('contact', 'PageController::contact'); }); $routes->group('auth', ['namespace' => 'App\Controllers\Auth'], function ($routes) { $routes->get('login', 'LocalController::login_form'); diff --git a/app/Config/Services.php b/app/Config/Services.php index 6a95687..5ca0c0d 100644 --- a/app/Config/Services.php +++ b/app/Config/Services.php @@ -79,7 +79,15 @@ class Services extends BaseService new \App\Models\UserModel() ); } - + public static function pageservice($getShared = true): BoardService + { + if ($getShared) { + return static::getSharedInstance(__FUNCTION__); + } + return new BoardService( + new \App\Models\BoardModel(), + ); + } public static function boardservice($getShared = true): BoardService { if ($getShared) { diff --git a/app/Controllers/Front/WelcomeController.php b/app/Controllers/Front/PageController.php similarity index 52% rename from app/Controllers/Front/WelcomeController.php rename to app/Controllers/Front/PageController.php index 04f096e..446ab3c 100644 --- a/app/Controllers/Front/WelcomeController.php +++ b/app/Controllers/Front/PageController.php @@ -6,13 +6,13 @@ use CodeIgniter\HTTP\RequestInterface; use CodeIgniter\HTTP\ResponseInterface; use Psr\Log\LoggerInterface; -class WelcomeController extends FrontController +class PageController extends FrontController { public function initController(RequestInterface $request, ResponseInterface $response, LoggerInterface $logger) { parent::initController($request, $response, $logger); if ($this->service === null) { - $this->service = service('userservice'); + $this->service = service('pageservice'); } } protected function action_init_process(string $action, array $formDatas = []): void @@ -32,6 +32,30 @@ class WelcomeController extends FrontController { $action = __FUNCTION__; $this->action_init_process($action); - return $this->action_render_process($action, $this->getViewDatas(), $this->request->getVar('ActionTemplate') ?? "welcome"); + return $this->action_render_process('welcome', $this->getViewDatas(), $this->request->getVar('ActionTemplate') ?? "page"); + } + public function about_us(): string + { + $action = __FUNCTION__; + $this->action_init_process($action); + return $this->action_render_process($action, $this->getViewDatas(), $this->request->getVar('ActionTemplate') ?? "page"); + } + public function products(): string + { + $action = __FUNCTION__; + $this->action_init_process($action); + return $this->action_render_process($action, $this->getViewDatas(), $this->request->getVar('ActionTemplate') ?? "page"); + } + public function logistics_services(): string + { + $action = __FUNCTION__; + $this->action_init_process($action); + return $this->action_render_process($action, $this->getViewDatas(), $this->request->getVar('ActionTemplate') ?? "page"); + } + public function contact(): string + { + $action = __FUNCTION__; + $this->action_init_process($action); + return $this->action_render_process($action, $this->getViewDatas(), $this->request->getVar('ActionTemplate') ?? "page"); } } diff --git a/app/Forms/Auth/GoogleForm.php b/app/Forms/Auth/GoogleForm.php index 14befab..dcc7716 100644 --- a/app/Forms/Auth/GoogleForm.php +++ b/app/Forms/Auth/GoogleForm.php @@ -12,6 +12,7 @@ class GoogleForm extends CommonForm } public function action_init_process(string $action, array &$formDatas = []): void { + parent::action_init_process($action, $formDatas); $fields = ['access_code']; $filters = []; switch ($action) { diff --git a/app/Forms/Auth/LocalForm.php b/app/Forms/Auth/LocalForm.php index ce34561..3bead0a 100644 --- a/app/Forms/Auth/LocalForm.php +++ b/app/Forms/Auth/LocalForm.php @@ -12,6 +12,7 @@ class LocalForm extends CommonForm } public function action_init_process(string $action, array &$formDatas = []): void { + parent::action_init_process($action, $formDatas); $fields = ['id', 'passwd']; $filters = []; switch ($action) { diff --git a/app/Forms/BoardForm.php b/app/Forms/BoardForm.php index c0dffcf..8d1da73 100644 --- a/app/Forms/BoardForm.php +++ b/app/Forms/BoardForm.php @@ -12,6 +12,7 @@ class BoardForm extends CommonForm } public function action_init_process(string $action, array &$formDatas = []): void { + parent::action_init_process($action, $formDatas); $fields = [ 'category', 'worker_uid', diff --git a/app/Forms/InquiryForm.php b/app/Forms/InquiryForm.php index d4172d0..863e85f 100644 --- a/app/Forms/InquiryForm.php +++ b/app/Forms/InquiryForm.php @@ -13,6 +13,7 @@ class InquiryForm extends CommonForm } public function action_init_process(string $action, array &$formDatas = []): void { + parent::action_init_process($action, $formDatas); $fields = [ 'title', 'email', diff --git a/app/Forms/UserForm.php b/app/Forms/UserForm.php index 007bd8b..5fe6587 100644 --- a/app/Forms/UserForm.php +++ b/app/Forms/UserForm.php @@ -12,6 +12,7 @@ class UserForm extends CommonForm } public function action_init_process(string $action, array &$formDatas = []): void { + parent::action_init_process($action, $formDatas); $fields = [ 'id', 'passwd', diff --git a/app/Views/front/welcome/index.php b/app/Views/front/page/welcome.php similarity index 100% rename from app/Views/front/welcome/index.php rename to app/Views/front/page/welcome.php diff --git a/app/Views/front/welcome/hero.php b/app/Views/front/page/welcome/hero.php similarity index 100% rename from app/Views/front/welcome/hero.php rename to app/Views/front/page/welcome/hero.php diff --git a/app/Views/front/welcome/partner.php b/app/Views/front/page/welcome/partner.php similarity index 100% rename from app/Views/front/welcome/partner.php rename to app/Views/front/page/welcome/partner.php diff --git a/app/Views/front/welcome/whatwedo.php b/app/Views/front/page/welcome/whatwedo.php similarity index 100% rename from app/Views/front/welcome/whatwedo.php rename to app/Views/front/page/welcome/whatwedo.php diff --git a/app/Views/layouts/front/top.php b/app/Views/layouts/front/top.php index 67742e0..36b7c9b 100644 --- a/app/Views/layouts/front/top.php +++ b/app/Views/layouts/front/top.php @@ -126,11 +126,11 @@