fix: monitors page & pagination
This commit is contained in:
22
src/Twig/Components/PaginateTrait.php
Normal file
22
src/Twig/Components/PaginateTrait.php
Normal file
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
|
||||
namespace App\Twig\Components;
|
||||
|
||||
use Symfony\UX\LiveComponent\Attribute\LiveAction;
|
||||
use Symfony\UX\LiveComponent\Attribute\LiveArg;
|
||||
use Symfony\UX\LiveComponent\Attribute\LiveProp;
|
||||
|
||||
trait PaginateTrait
|
||||
{
|
||||
#[LiveProp(writable: true)]
|
||||
public int $pageNumber = 1;
|
||||
|
||||
#[LiveProp(writable: true)]
|
||||
public int $perPage = 5;
|
||||
|
||||
#[LiveAction]
|
||||
public function paginate(#[LiveArg] int $page)
|
||||
{
|
||||
$this->pageNumber = $page;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user