title: Laravel - Passing Parameters/ undefined variable
body: <p>I'm struggling with passing parameters through in Laravel, I can access it via URL but I don't want that. I'm getting Undefined variable: user in the master.blade error.</p>
  
  <p>Any help is appreciated</p>
  
  <p>AuthController.php</p>
  
  <pre><code> function viewUserDetails($userId)
  {
      $user = User::find($userId);
      return view('user/userdetails',['user' =&gt; $user]);
  }
  </code></pre>
  
  <p>Web.php</p>
  
  <pre><code>Route::get('userdetails/{userId}', 'AuthController@viewUserDetails');
  </code></pre>
  
  <p>Master.Blade</p>
  
  <pre><code>&lt;li&gt;&lt;a href="{{url('userdetails/'.$user-&gt;id)}}"&gt;Your Details&lt;/a&gt;&lt;/li&gt;
  </code></pre>