withPaginator() public method

Respond with a paginator, and a transformer.
public withPaginator ( Illuminate\Contracts\Pagination\LengthAwarePaginator $paginator, callable | League\Fractal\TransformerAbstract $transformer, string $resourceKey = null, array $meta = [] ) : Illuminate\Contracts\Routing\ResponseFactory
$paginator Illuminate\Contracts\Pagination\LengthAwarePaginator
$transformer callable | League\Fractal\TransformerAbstract
$resourceKey string
$meta array
return Illuminate\Contracts\Routing\ResponseFactory
 /**
  * Returns a paginated collection
  * 
  * @return \Illuminate\Http\JsonResponse
  */
 public function collection()
 {
     $limit = \Input::get('limit') ?: 10;
     $model = $this->model;
     if (\Request::has('order')) {
         list($orderCol, $orderBy) = explode('|', \Input::get('order'));
         $model = $model->orderBy($orderCol, $orderBy);
     }
     return $this->response->withPaginator($model->paginate($limit), new $this->transformerName(), $this->collectionName);
 }