title: Laravel 5: How to run same query when click to pagination links
body: <p>I am creating a dynamic query depending on user's form selections and diplaying the query result as paginated.</p>
  
  <pre><code>            $query = 'v.id';
  
              if($model == 1){
                  $query .= ' ,v.model';
              }
  
              if($marka == 1){
                  $query .= ' ,v.brand_name';
              }
  
              if($plaka == 1){
                  $query .= ' ,v.licenseplate';
              }
  
              if($fiyat == 1){
                  $query .= ' ,v.buying_price';
              }
              .
              .      
              .
  
  
              $query_result = DB::table('vehicles AS v')   
              -&gt;selectRaw($query)
              -&gt;paginate(25);
  </code></pre>
  
  <p>The problem is, once i click to pagination links page is refreshing and dynamic query backs to its initial value so most of the data gets missed. I tried to use <code>appends()</code> but couldnt find a proper solution so far. Any help would be appreciated.</p>