<?php
namespace App\Controller;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Annotation\Route;
class PageController extends AbstractController
{
#[Route('/', name: 'app_page')]
public function index(): Response
{
return $this->render('page/index.html.twig', [
'controller_name' => 'PageController',
]);
}
#[Route('/alameda', name: 'app_alameda')]
public function alameda(): Response
{
return $this->render('page/alameda.html.twig');
}
#[Route('/lote/{id}', name: 'app_lote')]
public function lote($id): JsonResponse
{
$data = [
'id' => $id,
'name' => 'Lote 1',
'description' => 'Alameda Lote 1',
'modelo' => 'Townhouse',
'terreno' => 166.55,
'construccion' => 125.2,
'price' => 3398678.2
];
return new JsonResponse($data);
}
#[Route('/lotes', name: 'app_lotes')]
public function lotes(): JsonResponse
{
$data = [
[
'id' => 1,
'name' => 'Lote 1',
'description' => 'Lote 1 description',
'price' => 1000
],
[
'id' => 2,
'name' => 'Lote 2',
'description' => 'Lote 2 description',
'price' => 2000
],
[
'id' => 3,
'name' => 'Lote 3',
'description' => 'Lote 3 description',
'price' => 3000
]
];
return new JsonResponse($data);
}
}