@Sinnbeck
I figured that out right quick when I came upon this example, however, I came up with an alternative that does work in some cases in vanilla laravel.
In my case, I have default values for a store api and a particular listing i'm looking for in my default store. So I want a 'find listings' route that defaults the items omitted. I should note, that optional items using this method requires them to be 'in order'. i.e. you can't leave out the first item if you include the second. It's kinda similar how stuff like C++ allows multiple definitions for a function:
My routes for getting shop details only needs the shopid to be optional. Getting shop listings for a specific listingid, I need both listingid and shopid but assume if I get just a listingid, it's for my default shop. If I get neither, it's for the default listing in my default shop:
Route::get('/getshop/{shopid?}', [EtsyapiController::class, 'getshop'])->name('etsyadmin.getshop');
// need to define two separate routes:
// one for nothing with optional listingid
// a second for with listingid with optional shopid
Route::get('/getlistings/{listingid?}', [EtsyapiController::class, 'getlistings']);
Route::get('/getlistings/{listingid}/{shopid?}', [EtsyapiController::class, 'getlistings']);
It should be noted that I'm defaulting my variables in the controller action to ='' then checking if they are empty to substitute a value from .env
It might get interesting if you try to name routes for redirects somewhere though. Maybe name one 'withlistingid' or something.