Pagination with Twig and Eloquent-5.2
<p>After following this video tutorial on building a <a href="https://www.youtube.com/playlist?list=PLfdtiltiRHWGKUvioJly40RJZchSG2-34" rel="nofollow">PHP Authentication System</a> with Slim/Twig and Eloquent 5.2.</p>

<p>I have finished the video tutorial and have a working system.
But I am failing to add pagination to the all user list on the <a href="https://www.youtube.com/watch?v=dOJetM8zGzI&amp;index=25&amp;list=PLfdtiltiRHWGKUvioJly40RJZchSG2-34" rel="nofollow">25th episode</a> of the tutorial.</p>

<p><strong>Everything seems to work fine. but when I press page 2,3,4,etc... I am still getting the page 1 data.</strong></p>

<p>Here is the code I have so far:</p>

<p><strong><em>routes/user/all.php</em></strong></p>

<pre><code>    $app-&gt;get('/users', $authenticated(), function() use ($app) {
        $users = $app-&gt;user-&gt;where('active', true)-&gt;paginate(5);
        $users-&gt;setPath($app-&gt;urlFor('user.all'));

        $app-&gt;render('user/all.php', [
            'users' =&gt; $users
        ]);
    })-&gt;name('user.all');
</code></pre>

<p><strong><em>view/user/all.php</em></strong></p>

<pre><code>{% extends 'templates/default.php' %}

{% block title %}All Users{% endblock %}

{% block content %}
    &lt;h4&gt;All Users&lt;/h4&gt;
    {% if users is empty %}
        &lt;p&gt;No registered users&lt;/p&gt;
    {% else %}
        {% for user in users %}
            &lt;div class="user"&gt;
                &lt;a href="{{ urlFor('user.profile', {username: user.username}) }}"&gt;&lt;img src="{{ user.getAvatarUrl({size: 18}) }}"&gt; {{ user.username }}{% if user.getFullName %} | {{ user.getFullName }}{% endif %}&lt;/a&gt;
                {% if user.isAdmin() %}
                    [Admin]
                {% endif %}
            &lt;/div&gt;
        {% endfor %}
        {{ users.render()|raw }}
    {% endif %}
{% endblock %}
</code></pre>

<p><strong>composer.json</strong></p>

<pre><code>{
    "autoload": {
        "psr-4": {
            "A146\\": "app/A146"
        }
    },
    "require": {
        "slim/slim": "~2.0",
        "slim/views": "0.1.*",
        "twig/twig": "~1.21",
        "phpmailer/phpmailer": "~5.2",
        "hassankhan/config": "0.8.*",
        "illuminate/database": "5.*",
        "illuminate/pagination": "5.*",
        "alexgarrett/violin": "2.*",
        "ircmaxell/random-lib": "~1.1",
        "fzaninotto/faker": "*"
    }
}
</code></pre>

<p><strong>Here is the output I get:</strong></p>

<pre><code>&lt;div class="row"&gt;
&lt;h4&gt;All Users&lt;/h4&gt;
    &lt;div class="user"&gt;
        &lt;a href="/pcb/public/u/Admin"&gt;&lt;img src="http://www.gravatar.com/avatar/...?s=18&amp;amp;d=identicon"&gt; Admin&lt;/a&gt; [Admin]
    &lt;/div&gt;
    &lt;div class="user"&gt;
        &lt;a href="/pcb/public/u/Jamarcus22"&gt;&lt;img src="http://www.gravatar.com/avatar/...?s=18&amp;amp;d=identicon"&gt; Jamarcus22 | Abbie O&amp;#039;Hara&lt;/a&gt;
    &lt;/div&gt;
    &lt;div class="user"&gt;
        &lt;a href="/pcb/public/u/jWalker"&gt;&lt;img src="http://www.gravatar.com/avatar/...?s=18&amp;amp;d=identicon"&gt; jWalker | Salvador Douglas&lt;/a&gt;
    &lt;/div&gt;
    &lt;div class="user"&gt;
        &lt;a href="/pcb/public/u/Karelle00"&gt;&lt;img src="http://www.gravatar.com/avatar/...?s=18&amp;amp;d=identicon"&gt; Karelle00 | Harmon Ryan&lt;/a&gt;
    &lt;/div&gt;
    &lt;div class="user"&gt;
        &lt;a href="/pcb/public/u/lCarter"&gt;&lt;img src="http://www.gravatar.com/avatar/...?s=18&amp;amp;d=identicon"&gt; lCarter | Lilly Stokes&lt;/a&gt;
    &lt;/div&gt;
&lt;ul class="pagination"&gt;&lt;li class="disabled"&gt;&lt;span&gt;&amp;laquo;&lt;/span&gt;&lt;/li&gt; &lt;li class="active"&gt;&lt;span&gt;1&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="/pcb/public/users?page=2"&gt;2&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="/pcb/public/users?page=3"&gt;3&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="/pcb/public/users?page=4"&gt;4&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="/pcb/public/users?page=5"&gt;5&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="/pcb/public/users?page=6"&gt;6&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="/pcb/public/users?page=7"&gt;7&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="/pcb/public/users?page=2" rel="next"&gt;&amp;raquo;&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;
&lt;/div&gt;
</code></pre>

<p>any help is very appreciated!</p>