Note that there are some explanatory texts on larger screens.

plurals
  1. POVariables in route group prefixes in Laravel 4
    primarykey
    data
    text
    <p>Given the below routes it will respond to </p> <blockquote> <p><a href="http://example.com/game/stats/123" rel="nofollow">http://example.com/game/stats/123</a><br> <a href="http://example.com/game/stats/game/123" rel="nofollow">http://example.com/game/stats/game/123</a><br> <a href="http://example.com/game/stats/reviewer/123" rel="nofollow">http://example.com/game/stats/reviewer/123</a> </p> </blockquote> <p>What I want to know is, how can I make it respond to </p> <blockquote> <p><a href="http://example.com/game/123/stats" rel="nofollow">http://example.com/game/123/stats</a><br> <a href="http://example.com/game/123/stats/game" rel="nofollow">http://example.com/game/123/stats/game</a><br> <a href="http://example.com/game/123/stats/reviewer" rel="nofollow">http://example.com/game/123/stats/reviewer</a> </p> </blockquote> <p>I tried doing </p> <pre><code>Route::group(['prefix' =&gt; 'game/{game}'], function($game){ </code></pre> <p>But that fails with "Missing argument 1 for {closure}()"</p> <p>Note that there are four other groups apart from stats but I have omitted them for this example for brevity.</p> <pre><code>Route::group(['prefix' =&gt; 'game'], function(){ Route::group(['prefix' =&gt; 'stats'], function(){ Route::get('/{game}', ['as' =&gt; 'game.stats', function ($game) { return View::make('competitions.game.allstats'); }]); Route::get('game/{game}', ['as' =&gt; 'game.stats.game', function ($game) { return View::make('competitions.game.gamestats'); }]); Route::get('reviewer/{game}', ['as' =&gt; 'game.stats.reviewer', function ($game) { return View::make('competitions.game.reviewstats'); }]); }); }); </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload