- Moved logic from MainController to dedicated action and task classes. - Introduced GetMainPageDataAction, GetEducationsDataTask, GetRecentPostsTask, GetUpcomingEventsTask, and GetPageDataTask for better separation of concerns. - Updated routes to use the new MainController from the Main container. - Deprecated the old MainController with a clear message for future removal. - Updated caching mechanisms to use the new task classes. - Adjusted environment variable access to use config() instead of env() for better practice. - Added new MainPageResource for structured data response. - Updated .gitignore to exclude QWEN.md. - Added Jenkins service to docker-compose for CI/CD integration.
35 lines
1.0 KiB
PHP
35 lines
1.0 KiB
PHP
<?php
|
|
|
|
namespace App\Containers\Main\Actions;
|
|
|
|
use App\Containers\Main\Tasks\GetEducationsDataTask;
|
|
use App\Containers\Main\Tasks\GetRecentPostsTask;
|
|
use App\Containers\Main\Tasks\GetUpcomingEventsTask;
|
|
use App\Containers\Main\Tasks\GetPageDataTask;
|
|
|
|
class GetMainPageDataAction
|
|
{
|
|
public function __construct(
|
|
private readonly GetEducationsDataTask $getEducationsDataTask,
|
|
private readonly GetRecentPostsTask $getRecentPostsTask,
|
|
private readonly GetUpcomingEventsTask $getUpcomingEventsTask,
|
|
private readonly GetPageDataTask $getPageDataTask,
|
|
) {}
|
|
|
|
public function run(): array
|
|
{
|
|
$educations = $this->getEducationsDataTask->run();
|
|
$posts = $this->getRecentPostsTask->run();
|
|
$events = $this->getUpcomingEventsTask->run();
|
|
$page = $this->getPageDataTask->run();
|
|
|
|
$seo = $page->seo ?? null;
|
|
|
|
return [
|
|
'educations' => $educations,
|
|
'posts' => $posts,
|
|
'events' => $events,
|
|
'seo' => $seo
|
|
];
|
|
}
|
|
} |