23 lines
455 B
PHP
23 lines
455 B
PHP
<?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;
|
|
}
|
|
}
|