title: How do I pass a value in my Route to the Controller to be used in the View in Laravel?
body: <p>I have 2 entities called <strong>Match</strong> and <strong>Roster</strong>.
  My Match routes are like this</p>
  <p><code>http://localhost:8888/app/public/matches</code> (index)
  <code>http://localhost:8888/app/public/matches/14</code> (show)</p>
  <p>In order to view/create the teams for each specific match I added the routes for the match roster like this:</p>
  <pre><code>Route::get('/matches/'.'{id}'.'/roster/', [App\Http\Controllers\RosterController::class, 'index']);
  </code></pre>
  <p>Now I need that {id} i have in my URL to pass it to the Controller here:</p>
  <pre><code>public function index()
      {
          return view('roster.index');
      }
  </code></pre>
  <p>I need that for a couple of things. First I need to do a search on the Roster table filtering by a column with that value, so I can display only the players that belong to that match.</p>
  <p>Second, I need to pass it on to the view so I can use it on my store and update forms. I want to add or remove players from the roster from that same index view.</p>
  <p>How can I do that?</p>