title: how to pass parameter to show() method in resource controller from another function
body: <p>I know that the route name for <code>show($id)</code> method is <code>some_name/parameter</code>.Here i have a login authentication mechanism and i want to show the user profile if the user passed the authentication.I have a function called <code>loginUser()</code> inside my <code>userController</code>.I want to redirect the user to user.show route on successful login.But i am not sure how to pass the parameter value to show method.Currently i am getting the error:</p>
  
  <blockquote>
    <p>Missing required parameters for [Route: user.show] [URI: user/{user}].</p>
  </blockquote>
  
  <p><strong>loginUser() function:</strong></p>
  
  <pre><code>public function loginUser(Request $request){
  
          $data = $request-&gt;all();
  
          $rules = array(
             'name' =&gt; 'required',
             'password'=&gt;'required'
          );
  
          // Create a new validator instance.
          $validator = Validator::make($data, $rules);
          if($validator-&gt;fails()){
  
              $errors=$validator-&gt;messages();
              return redirect()-&gt;back()-&gt;withErrors($validator);
  
          }else{
  
              if(Auth::attempt(['name'=&gt;$request['name'],'password'=&gt;$request['password']])){
  
                  return redirect()-&gt;route('user.show')-&gt;with('name',$request['name']); // pass control to show() function
              }else{
                  return redirect()-&gt;back()-&gt;with('data', 'wrong username or password');
              }
          }
      }
  </code></pre>
  
  <p><strong>show() method in userController:</strong></p>
  
  <pre><code>public function show($user)
  {
      //
      $info=userModel::where('id','=',$user)-&gt;get(array('name'));
      return View::make('user.show')-&gt;with('name',$info);
  
  }
  </code></pre>