deblan.io-murph/src/Controller/DashboardAdminController.php
Simon Vieille 0c7922eb9b
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
update dashboard
2023-05-21 12:42:04 +02:00

36 lines
942 B
PHP

<?php
namespace App\Controller;
use App\Core\Controller\Dashboard\DashboardAdminController as Controller;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Annotation\Route;
use App\Repository\Blog\PostRepositoryQuery;
use App\Repository\ProjectRepositoryQuery;
#[Route(path: '/admin')]
class DashboardAdminController extends Controller
{
#[Route(path: '/', name: 'admin_dashboard_index')]
public function index(
PostRepositoryQuery $postQuery,
ProjectRepositoryQuery $projectQuery
): Response
{
$posts = $postQuery->create()
->orderBy('.id', 'DESC')
->paginate(1, 4)
;
$projects = $projectQuery->create()
->orderBy('.id', 'DESC')
->paginate(1, 3)
;
return $this->render('admin/dashboard.html.twig', [
'posts' => $posts,
'projects' => $projects,
]);
}
}