Search code examples
laravelroutesslug

get a specified parameter in a route?


I have a route with multi parameters. How could I get slug in below route?

Route::apiResource('/tournaments/{tournament}/structures/{slug}', '\SingleController');

Solution

  • You can get it directly, documentation for your reference:

    public function index($tournament, $slug) {}
    
    public function show($tournament, $slug, $id) {}
    
    public function store($tournament, $slug) {}