title: Laravel undefined variable ID Controller
body: <p>I am getting below error:</p>
  
  <blockquote>
    <p>ErrorException (E_UNKNOWN)  Undefined variable: id</p>
  </blockquote>
  
  <p>below is my code, It is from "Controller"</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>public function show($id)
   {
    if(Auth::user()) {
     $message = Message::where(function($query) {
      $query-&gt;where('from_user', '=', Auth::user()-&gt;username)-&gt;where('id', '=', $id);
     })-&gt;orWhere(function($query) {
      $query-&gt;where('from_user', '=', Auth::user()-&gt;username)-&gt;where('id', '=', $id);
     });
     if($message == null) {
      return Redirect::action('MessageController@index');
     }
     return View::make('view', ['message' =&gt; $message, 'active' =&gt; 'none']);
    }
   }</code></pre>
  </div>
  </div>
  </p>
  
  <p><strong>Update:</strong> My Route is : <code>Route::get('/message/{id}', 'MessageController@show')-&gt;before('auth');</code></p>
  
  <p>I could not understand, what i am messing with up, I have already passed <code>$id</code> in function argument.</p>