title: get url id in a middleware in Laravel 5
body: <p>I'm making a middleware that check the ownership of an tournament.</p>
  
  <p>So in the url, I have :</p>
  
  <blockquote>
    <p><a href="http://laravel.dev:8000/tournaments/1/edit" rel="nofollow noreferrer">http://laravel.dev:8000/tournaments/1/edit</a></p>
  </blockquote>
  
  <p>I need to get the "1" in $tournamentId</p>
  
  <p>In the middleware, I only have $request and $closure parameters, so I tried </p>
  
  <pre><code>$tournamentId = $request-&gt;get("tournaments");
  </code></pre>
  
  <p>and as @Amir Bar says:</p>
  
  <pre><code>$tournamentId = $request-&gt;tournaments;
  </code></pre>
  
  <p>I checked the routes with</p>
  
  <pre><code>php artisan route:list
  </code></pre>
  
  <p>And I get</p>
  
  <pre><code>GET|HEAD | tournaments/{tournaments}        | tournaments.show         | App\Http\Controllers\TournamentController@show      | auth,roles,ownTournament |
  DELETE   | tournaments/{tournaments}        | tournaments.destroy      | App\Http\Controllers\TournamentController@destroy   | auth,roles,ownTournament |
  PATCH    | tournaments/{tournaments}        |                          | App\Http\Controllers\TournamentController@update    | auth,roles,ownTournament |
  PUT      | tournaments/{tournaments}        | tournaments.update       | App\Http\Controllers\TournamentController@update    | auth,roles,ownTournament |
  GET|HEAD | tournaments/{tournaments}/edit   | tournaments.edit         | App\Http\Controllers\TournamentController@edit      | auth,roles,ownTournament |          | auth,roles,ownTournament |
  </code></pre>
  
  <p>but nothing works...</p>
  
  <p>My middleware:</p>
  
  <pre><code>class OwnTournament
  {
      /**
       * Check the ownership of tournaments
       *
       * @param  \Illuminate\Http\Request  $request
       * @param  \Closure  $next
       * @return mixed
       */
      public function handle($request, Closure $next)
      {
          dd($request-&gt;route());
          return $next($request);
      }
  }
  </code></pre>
  
  <p>Any idea how should I do it???</p>