title: Laravel middleware get route parameter
body: <p>I am coding some thing like 'school club manage system' and meet some problem on rights authorization of resource .</p>
  
  <p>Suppose there are <code>club</code> , and <code>club</code> have manager , and i want to check if the user is a manager of <code>club</code> before he can manage it  with a middleware.</p>
  
  <p>Using laravel 5.2</p>
  
  <p>My  <code>router</code> looks like that :</p>
  
  <p><code>Route::resource('club', 'ClubController');</code></p>
  
  <p>The middleware I create looks like that :</p>
  
  <pre><code>  public function handle($request, Closure $next)
      {
          if (!Auth::check()){
              // ask user to login
          }
  
          $club = Club::findOrFail($request-&gt;input('club'));
          $user = Auth::user();
  
          if (!$club-&gt;managers-&gt;contains($user)){
              //tell user your are not manager .
          }
  
          return $next($request);
  }
  </code></pre>
  
  <p>But I failed to get the id of club from <code>requests</code> .</p>
  
  <p>How can I solve the problem ?</p>
  
  <p>Thanks in advance .</p>