title: Route Passing a value
body: <p>newbie in laravel.</p>
  
  <p>In laravel sample routing</p>
  
  <pre><code>Route::get('books/{genre}', 'controller@method');
  </code></pre>
  
  <p>The link would be something like this</p>
  
  <p><code>link.com/books/crime</code> or <code>link.com/books/programming</code></p>
  
  <p>how do i do it if I want to get both  genre?</p>
  
  <p>if this possible is to achieve</p>
  
  <pre><code>link.com/books?genre=crime,programming
  </code></pre>
  
  <p>how do i write that in routes? and also how do i get the value in controller?</p>
  
  <p>I have tried something like this. But I don't have any idea how to achieve it.</p>
  
  <pre><code>Route::get('books?{genre?}', 'controller@method');
  </code></pre>
  
  <p>Controller part</p>
  
  <pre><code>function method($fields = null) {
      return jsonData;
  }
  </code></pre>
  
  <p><strong>Found a way but its kinda awful...</strong></p>
  
  <p>route</p>
  
  <pre><code>Route::get('books', 'controller@method');
  </code></pre>
  
  <p>url </p>
  
  <pre><code>link.com/books?genre=crime,programming,love,religion
  </code></pre>
  
  <p>method </p>
  
  <pre><code>function method() {
       $array = explode(',',$_GET['fields');
       //.....
       return jsonData;
   }
  </code></pre>