title: Pagination with Eloquent-5.3 using Slim 3
body: <p>Here's my code for the pagination:</p>
  
  <p><strong>Controller:</strong></p>
  
  <pre><code>public function index($request, $response) {
  
      $current_page = $request-&gt;getParam('page');
  
      Paginator::currentPageResolver(function() use ($current_page) {
          return $current_page;
      });
  
      $routes = $this-&gt;route-&gt;paginate(2);
  
      return $this-&gt;view-&gt;render($response, 'dashboard/dashboard.twig', [
          'routes' =&gt; $routes
      ]);
  }
  </code></pre>
  
  <p><strong>View:</strong></p>
  
  <pre><code>{% for route in routes %}
      {{ route.route_name }}&lt;br&gt;
  {% endfor %}
  </code></pre>
  
  <p>There's no problem with that when I run the browser. It also works whenver I add <code>page</code> parameter in the url.</p>
  
  <p><a href="https://i.stack.imgur.com/Ut30d.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Ut30d.png" alt="enter image description here"></a></p>
  
  <p>But when I try to add the <code>links</code> method in the paginate object.</p>
  
  <pre><code>{% for route in routes %}
      {{ route.route_name }}&lt;br&gt;
  {% endfor %}
  
  {{ routes.links() }} {# &lt;--- This one #}
  </code></pre>
  
  <p>It prompts me an error</p>
  
  <blockquote>
    <p>Message: Call to a member function make() on null</p>
    
    <p>File: C:\xampp\htdocs...\vendor\illuminate\pagination\LengthAwarePaginator.php</p>
  </blockquote>
  
  <p><strong>Update:</strong></p>
  
  <p>When I try to echo the <code>links()</code> method inside the Controller. I found this error.</p>
  
  <pre><code>$routes = $this-&gt;route-&gt;paginate(5);
  echo $routes-&gt;links();
  die();
  </code></pre>
  
  <blockquote>
    <p>Warning: call_user_func() expects parameter 1 to be a valid callback, no array or string given in C:\xampp\htdocs...\vendor\illuminate\pagination\AbstractPaginator.php on line 377</p>
  </blockquote>
  
  <p>Then I checked the source code, it's this one.</p>
  
  <pre><code>/**
   * Get an instance of the view factory from the resolver.
   *
   * @return \Illuminate\Contracts\View\Factory
   */
  public static function viewFactory()
  {
      return call_user_func(static::$viewFactoryResolver);
  }
  </code></pre>
  
  <p>Any solution for this? </p>
  
  <p>This method works in 5.2, referring to this link.</p>
  
  <p><a href="https://stackoverflow.com/questions/34696004/pagination-with-twig-and-eloquent-5-2/35532926#35532926">Pagination with Twig and Eloquent-5.2</a></p>
  
  <p>But unfortunely, it doesn't work anymore.</p>