title: Laravel 5.5 pass a parameter from a controller to a resource
body: <p>I have difficult to figure out how I can pass a parameter from a method in a controller to a resource.</p>
  
  <p>In the web.php I have this route:</p>
  
  <pre><code>Route::get('location/{id}','Controller@getLocation');
  </code></pre>
  
  <p>Below the method in a controller class:</p>
  
  <pre><code>public function getLocation($id){ 
      $result= //query
      return new LocationResource($result);
  }
  </code></pre>
  
  <p>I wanto to pass the <code>$id</code> from controller to LocationResource. How can I do?
  Thanks</p>