In Laravel 6, when defining a route, use the global config function to access the configuration value
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 you need to adjust /static/xxx to get the value from the environment variable, that is, use 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. Print output/ / *. config(filesystems.disks.theme-asset-cdn.root) .{theme_id}/{asset_key}, its value is: /static/xxx/{theme_id}/{asset_key} . and the corresponding controller method can be executed. in line with expectations. as shown in Figure 1
/static/xxx/{theme_id}/{asset_key}
4. When/ / *. config(filesystems.disks.theme-asset-cdn.root) .{theme_id}/{asset_key}The value is: /static/theme-2.0-test/xxx/{theme_id}/{asset_key}. The corresponding controller method can be executed. in line with expectations. as shown in Figure 2

