diff --git a/src/Controller/MainController.php b/src/Controller/MainController.php index 8e71543..597c060 100644 --- a/src/Controller/MainController.php +++ b/src/Controller/MainController.php @@ -41,4 +41,47 @@ class MainController extends AbstractController ] ); } + + #[Route( + '/{transaction}', + name: 'main_transaction', + requirements: + [ + 'transaction' => '^[A-f0-9]{64}$', + ], + methods: + [ + 'GET' + ] + )] + public function transaction( + ?Request $request + ): Response + { + $index = new \Kvazar\Index\Manticore(); + + $records = $index->get( + '', + [ + 'crc32transaction' => crc32( + $request->get('transaction') + ) + ] + ); + + if (empty($records)) + { + throw $this->createNotFoundException(); + } + + return $this->render( + 'default/main/transaction.html.twig', + [ + 'request' => $request, + 'record' => reset( + $records + ) + ] + ); + } } \ No newline at end of file diff --git a/templates/default/layout.html.twig b/templates/default/layout.html.twig index 7f3ae97..48ff2e1 100644 --- a/templates/default/layout.html.twig +++ b/templates/default/layout.html.twig @@ -8,5 +8,30 @@
{% block body %}{% endblock %} +