title: getting query parameters from URL in laravel 7.1
body: <p>Just as a learning exercise, I'm creating a REST API in Laravel 7.1. I'm having trouble figuring out how to parse the query string parameters in route methods. I've read over the documentation <a href="https://laravel.com/docs/7.x/routing" rel="nofollow noreferrer">here</a>, and it shows how to add parameters into the path:</p>
  
  <pre><code>Route::get('user/{id}', function ($id) {
      return 'User '.$id;
  });
  </code></pre>
  
  <p>However I don't see where you can get query parameters from the request URL. In my toy code, I want to add a route to add a new car to inventory:</p>
  
  <pre><code>Route::post('/inventory/add/{make}/{model}/{year}', function ($make, $model, $year) {
      return \App\Inventory::create($model, $color, $trim, $accessories);
  });
  </code></pre>
  
  <p>I want to specify parameters such as color, trim, and accessories through the query string, like so:</p>
  
  <pre><code>http://example.com/inventory/add/ford/focus/2020?color=red&amp;trim=sport&amp;accessories=chrome-wheels
  </code></pre>
  
  <p>How do I get the query parameters out of the <code>Route::post</code> method?</p>
  
  <p><strong>Edit</strong> I suppose this architecture may not be the optimal way of adding this extra information, but since I am trying to learn laravel, I am using it as an example. I am interested in learning how to get the query parameters moreso than how to improve the architecture of this learning example. </p>