$filter * @return LengthAwarePaginator */ public function handle(array $filter, int $perPage): LengthAwarePaginator { return FilterScope::fromPost($filter)->getQuery()->paginate($perPage); } public function asController(ActionRequest $request): AnonymousResourceCollection { return MemberResource::collection($this->handle($request->input('filter', []), $request->input('per_page', 15))); } }