Add ability to remove feeds

This commit is contained in:
Lewis Dale committed 2024-12-31 16:32:00 +00:00
1 parent 5c8892e12f
commit cee4f9944e
6 files changed
+26 -7

No files matched your search

+12
View File
@@ -54,4 +54,16 @@ class FeedController
return $this->view->render($response, 'create.twig.html');
}
public function delete(ServerRequestInterface $request, ResponseInterface $response): ResponseInterface
{
$this->logger->info("FeedController::delete() called");
$feed = $this->feedRepository->find($request->getAttribute('id'));
if (empty($feed)) {
return $response->withStatus(404);
}
$this->feedRepository->delete($feed);
return $response->withStatus(201)->withHeader('Location', '/feed');
}
}