26 lines
755 B
PHP
26 lines
755 B
PHP
<?php
|
|
|
|
namespace App\Twig\Components;
|
|
|
|
use App\Monitor\Framework\Repository\MonitorRepository;
|
|
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
|
use Symfony\UX\LiveComponent\Attribute\LiveAction;
|
|
use Symfony\UX\LiveComponent\Attribute\LiveArg;
|
|
use Symfony\UX\TwigComponent\Attribute\AsTwigComponent;
|
|
|
|
#[AsTwigComponent]
|
|
final class MonitorList extends AbstractController
|
|
{
|
|
public bool $isWidget = true;
|
|
|
|
public function __construct(
|
|
private readonly MonitorRepository $monitorRepository,
|
|
) {}
|
|
|
|
#[LiveAction]
|
|
public function getUserMonitors(#[LiveArg] int $page = 1, #[LiveArg] int $perPage = 5)
|
|
{
|
|
return $this->monitorRepository->getUserMonitorsPaginated($this->getUser(), $page, $perPage);
|
|
}
|
|
}
|