/** * Gets and caches a paginate for the resource. * * @param int $perPage * @param int $page * @param array $columns * @return mixed */ public function paginate($perPage = 15, $page = 1, $columns = array('*')) { $key = $this->generateCacheKey('paginate' . serialize([$perPage, $page, $columns])); $result = $this->cache->tags($this->getCacheTag())->remember($key, $this->duration, function () use($perPage, $columns, $page) { return $this->repository->paginate($perPage, $page, $columns); }); $this->resetScope(); return $result; }