$this->collection->map(function ($page) { return [ 'page_id' => $page->id, 'title' => $page->title, 'sub_title' => $page->sub_title, 'tags' => TagResource::collection($page->tags), 'description' => $page->description, 'slug' => $page->slug, 'cover' => $page->cover_url, 'pictures' => $page->pictures_url, 'clicks' => $page->clicks, 'created_at' => (string) $page->created_at, ]; }), 'page' => $this->page(), ]; } protected function page(): array { return [ 'current' => $this->currentPage(), 'total_page' => $this->lastPage(), 'per_page' => $this->perPage(), 'has_more' => $this->hasMorePages(), 'total' => $this->total(), ]; } }