1. In Laravel 6, define the route as follows
Route::get('/static/xxx/{theme_id}/{asset_key}', 'ThemeAssetController@show')->where('asset_key', '.*')->middleware('cache.headers:public;max_age=31536000;etag');
2. Now I need to change /static/xxx to read its value from an environment variable, which means using the global config function to access the configuration value
Route::get('/' . config('filesystems.disks.theme-asset-cdn.root') . '{theme_id}/{asset_key}', 'ThemeAssetController@show')->where('asset_key', '.*')->middleware('cache.headers:public;max_age=31536000;etag');
3. I print the output of ‘/’ . config(‘filesystems.disks.theme-asset-cdn.root’) . ‘{theme_id}/{asset_key}’, and its value is: /static/xxx/{theme_id}/{asset_key}. It also successfully executes the corresponding controller method. This matches expectations. See Figure 1

/static/xxx/{theme_id}/{asset_key}
4. When the value of ‘/’ . config(‘filesystems.disks.theme-asset-cdn.root’) . ‘{theme_id}/{asset_key}’ is: /static/theme-2.0-test/xxx/{theme_id}/{asset_key}. It successfully executes the corresponding controller method. This matches expectations. See Figure 2

