title: Laravel controller variable
body: <p>I started to learn Laravel a couple of days ago.
  Right now I have a problem with a variable in my controller, I always get this error: "Undefined variable: server_id".</p>
  
  <p>My route file looks like this:</p>
  
  <pre><code>Route::get('servers/{server_id}','ServersController@show');
  </code></pre>
  
  <p>And the action method in the related controller:</p>
  
  <pre><code>public function show($server_id)
  {
      $details = Server::with(array('details' =&gt; function($query)
      {
          $query-&gt;where('server_id', '=', $server_id);
  
      }))-&gt;get();
  
      return View::make('servers.show')-&gt;with('details', $details);
  }
  </code></pre>
  
  <p>I can use the var. $server_id in the function and also pass it to the view. But i can't use it in the where clause for the database query.</p>
  
  <p>I hope someone could explain me what the problem is and how to solve this.</p>