title: Passing dependency parameters to App::make() or App::makeWith() in Laravel
body: <p>I have a class that uses a dependency. I need to be able to dynamically set parameters on the dependency from the controller:</p>
  
  <pre><code>$objDependency = new MyDependency();
  $objDependency-&gt;setSomething($something);
  $objDependency-&gt;setSomethingElse($somethingElse);
  
  $objMyClass = new MyClass($objDependency);
  </code></pre>
  
  <p>How do I achieve this through the Service Container in Laravel? This is what I've tried but this seems wrong to me. In my AppServiceProvider:</p>
  
  <pre><code>$this-&gt;app-&gt;bind('MyClass', function($app,$parameters){
  
      $objDependency = new MyDependency();
      $objDependency-&gt;setSomething($parameters['something']);
      $objDependency-&gt;setSomethingElse($parameters['somethingElse']);
  
      return new MyClass($objDependency);
  }
  </code></pre>
  
  <p>And then in the controller i'd use this like:</p>
  
  <pre><code>$objMyClass = App:make('MyClass', [
      'something'     =&gt; $something, 
      'somethingElse' =&gt; $somethingElse
  ]);
  </code></pre>
  
  <p>Is this correct? Is there a better way I can do this?</p>
  
  <p>Thanks</p>