Laravel路由 - 多路径

I'm using laravel to make an API. The following endpoints will be available:

Currently I have:

Route::get('/{appname}/{network}/{device}', function()
{
    return 'Hello World';
});

This services /appname/network/device/ but what I would like is so it can be the following but in one route without the need for additional routing:

Route::get('/{appname}', function()
{
    return 'App Name';
});

Route::get('/{appname}/{network}', function()
{
    return 'App Name / Network';
});

Route::get('/{appname}/{network}/{device}', function()
{
    return 'App Name / Network / Device';
});

I understand that I could use RESTFUL controllers but this would only work (I believe) with names like:

public function getAppname()
{
    //app
}

But if I used:

public function getAppnameNetwork()
    {
        //app-network
    }

it would become:

/appname-network/

Any advice/help would be greatly appreciated.

Thanks :)

I think routing groups may be what you want.

http://laravel.com/docs/routing#route-groups will have more information.

If you need variable prefixes, check out: https://github.com/jasonlewis/enhanced-router

You can have optional routing parameters:

Route::get('/{appname}/{network?}/{device?}', function($appname, $network = null, $device = null)
{
    return "$appname - $network - $device";
});