title: pagination array laravel redirecting
body: <p>I am working with laravel and I work now with pagination for my array. </p>
  
  <p>When I want to paginate three items from my array, It will output correctly. I want to see my another four items on te next page, I redirect to the same page and see the first three items from my array, but not the another four.</p>
  
  <p>How my page works: First in an another view, I search on a item and make a GET request to my result controller and my result controller checks in the database the files and put it in an array. then, the result controller, returns the result page. with my pagination code.</p>
  
  <p>This is my return view code: </p>
  
  <pre><code>return view('Documentatie.result')-&gt;with('zoekdocument', $zoekdocument)-&gt;with('searchdoc', $searchdoc)-&gt;with('fileopslag', $fileopslag); //geeft waardes mee. 
  </code></pre>
  
  <p>the variable file $fileopslag is my array with the items.</p>
  
  <p>this is my pagination code:</p>
  
  <pre><code>$page = ! empty( $_GET['page'] ) ? (int) $_GET['page'] : 1;
  $total = count( $fileopslag ); //total items in array    
  $limit = 3; //per page    
  $totalPages = ceil( $total/ $limit ); //calculate total pages
  $page = max($page, 1); //get 1 page when $_GET['page'] &lt;= 0
  $page = min($page, $totalPages); //get last page when $_GET['page'] &gt; $totalPages
  $offset = ($page - 1) * $limit;
  if( $offset &lt; 0 ) $offset = 0;
  
  $show = array_slice( $fileopslag, $offset, $limit );
  </code></pre>
  
  <p>Then I show my results:</p>
  
  <pre><code> foreach($show as $shows){
  
   &lt;a href="/opendocument/{{basename($shows)}}" class="list-group-item"&gt;&lt;/a&gt;
  
  }
  </code></pre>
  
  <p>I see correctly three results. But when I want to the other page is see all files from my array, but not my another four. </p>
  
  <p>this is my redirect code:</p>
  
  <pre><code>&lt;?php
  
  
  $link = '/result/page=%d';
  $pagerContainer = '&lt;div style="width: 300px;"&gt;';   
  if( $totalPages != 0 ) 
  {
    if( $page == 1 ) 
    { 
      $pagerContainer .= ''; 
    } 
    else 
    { 
      $pagerContainer .= sprintf( '&lt;a href="' . $link . '" style="color: #c00"&gt; &amp;#171; prev page&lt;/a&gt;', $page - 1 ); 
    }
    $pagerContainer .= ' &lt;span&gt; page &lt;strong&gt;' . $page . '&lt;/strong&gt; from ' . $totalPages . '&lt;/span&gt;'; 
    if( $page == $totalPages ) 
    { 
      $pagerContainer .= ''; 
    }
    else 
    { 
      $pagerContainer .= sprintf( '&lt;a href="' . $link . '" style="color: #c00"&gt; next page &amp;#187; &lt;/a&gt;', $page + 1 ); 
    }           
  }                   
  $pagerContainer .= '&lt;/div&gt;';
  
  echo $pagerContainer;
  
  
  ?&gt;
  </code></pre>