0

I am able to limit pagination result in controller

$this->paginate = ['limit'=>2];

$products = $this->paginate($this->Products);

Now a scenario I need to limit result in view file.Using paginator helper is it possible to limit data in view ?

Niloy Rony
  • 602
  • 1
  • 8
  • 23
  • 1
    The paginator helper can't do such things, no, you'd have to actually do the pagination calculations and query building in the view layer. To be sure that this isn't an [**xy question**](https://meta.stackexchange.com/a/66378/227568), why do you need to paginate in the view? – ndm Jan 29 '20 at 14:53
  • I have a products view page. Where I need to view all products using pagination also there has a portion called latest products. Where I will show 5 products. I am trying to do it using single query. – Niloy Rony Jan 30 '20 at 06:46
  • You can use `array_slice()` on generated result. – Dariusz Majchrzak Jan 30 '20 at 11:34

0 Answers0