title: Constructor injection of route parameter
body: <p>I have a class which I am injecting into a controller along with a route parameter. I am then using a setter to set the route parameter in the class.</p>
  
  <p>routes</p>
  
  <pre><code>Route::get('path/of/url/with/{paramVar}', 'testController@testFunc)
  </code></pre>
  
  <p>controller</p>
  
  <pre><code>class testController
  {
      public function testFunc(MyClassInterface $class, $routeParamVar)
      {
          $class-&gt;setParam($routeParamVar);
          //do stuff here
          ...
  </code></pre>
  
  <p>service provider</p>
  
  <pre><code>public function register()
  {
      $this-&gt;bind('path\to\interface', 'path\to\concrete');
  }
  </code></pre>
  
  <p>I would instead like to inject the route parameter into the constructor of the class I am injecting into my controller. I know <a href="https://stackoverflow.com/a/29767443/817379">from this question</a> that I need to use the laravel container. </p>
  
  <p>I can inject other route parameters using <code>Request::class</code>, but how can I inject the route path parameter?</p>
  
  <p>I guess I would end up with something like this</p>
  
  <pre><code>class testController
  {
      public function testFunc(MyClassInterface $class)
      {
          //do stuff here
          ...
  </code></pre>