toQuery()->toBase()->getCountForPagination(); }, 0); } /** * Transform the request into a query. * * @return \Illuminate\Database\Eloquent\Builder */ public function toQuery() { return tap($this->lens()->query(LensRequest::createFrom($this), $this->newSearchQuery()), function ($query) { if (! $query instanceof Builder) { throw new LensCountException('Lens must return an Eloquent query instance in order to count lens resources.'); } }); } }