add element endpoint

This commit is contained in:
Yisroel Baum 2026-05-26 19:47:17 +03:00
parent f9c92f3206
commit 90de724f63
Signed by: yisroelbaum
GPG key ID: 0FA60884F75520A9
2 changed files with 27 additions and 0 deletions

View file

@ -0,0 +1,25 @@
<?php
namespace App\Controllers;
use App\Element\ElementRepository;
use Illuminate\Http\JsonResponse;
class ElementController
{
public function __construct(private ElementRepository $elementRepository)
{
}
public function show(int $id): JsonResponse
{
$element = $this->elementRepository->find($id);
return new JsonResponse([
'element' => [
'id' => $element->getId(),
'title' => $element->getTitle(),
],
], 200);
}
}