Ajoute le News Controller

This commit is contained in:
Colin FRIZOT
2022-11-22 08:47:06 +01:00
parent 86827d1983
commit 53038a5022
3 changed files with 26 additions and 1 deletions

View File

@@ -14,4 +14,11 @@ class UserController
$news = $di->getNewsGateway()->getPaginatedRecentNews();
return new HttpResponse(200, 'home', ['news' => $news]);
}
public function viewPost(DI $di, array $params): HttpResponse
{
$newsId = intval($params['id']);
$news = $di->getNewsGateway()->getById($newsId);
return new HttpResponse(200, 'home', ['news' => $news]);
}
}