32 lines
855 B
PHP
32 lines
855 B
PHP
<?php
|
|
|
|
namespace App\Twig\Components;
|
|
|
|
use App\Monitor\Framework\Repository\MonitorRepository;
|
|
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
|
use Symfony\UX\LiveComponent\Attribute\AsLiveComponent;
|
|
use Symfony\UX\LiveComponent\Attribute\LiveAction;
|
|
use Symfony\UX\LiveComponent\Attribute\LiveProp;
|
|
use Symfony\UX\LiveComponent\DefaultActionTrait;
|
|
|
|
#[AsLiveComponent]
|
|
final class MonitorList extends AbstractController
|
|
{
|
|
use DefaultActionTrait;
|
|
|
|
use PaginateTrait;
|
|
|
|
#[LiveProp(writable: true)]
|
|
public bool $isWidget = true;
|
|
|
|
public function __construct(
|
|
private readonly MonitorRepository $monitorRepository,
|
|
) {}
|
|
|
|
#[LiveAction]
|
|
public function getUserMonitors()
|
|
{
|
|
return $this->monitorRepository->getUserMonitorsPaginated($this->getUser(), $this->pageNumber, $this->perPage);
|
|
}
|
|
}
|