webman
webman copied to clipboard
How to set plugin route to load before dynamic route?
I have dynamic route in config/route.php like this (it load vue + vue router)
Route::disableDefaultRoute();
Route::get('[{path:.+}]', [IndexController::class, 'index'])->name('public.index');
then I add webman/push plugin that has its own route file but got error when run
FastRoute\BadRouteException: Static route "/plugin/webman/push/push.js" is shadowed by previously defined variable route "(.+)" for method "GET" in /Users/mactat/Work/Gambling/source/vendor/nikic/fast-route/src/DataGenerator/RegexBasedAbstract.php:95
Stack trace:
#0 /Users/mactat/Work/Gambling/source/vendor/nikic/fast-route/src/DataGenerator/RegexBasedAbstract.php(30): FastRoute\DataGenerator\RegexBasedAbstract->addStaticRoute('GET', Array, Array)
#1 /Users/mactat/Work/Gambling/source/vendor/nikic/fast-route/src/RouteCollector.php(44): FastRoute\DataGenerator\RegexBasedAbstract->addRoute('GET', Array, Array)
#2 /Users/mactat/Work/Gambling/source/vendor/workerman/webman-framework/src/Route.php(382): FastRoute\RouteCollector->addRoute('GET', '/plugin/webman/...', Array)
I think if I can set the plugin route to load first it will work but dont know how to set it or any other solution to fix this
/**
* 推送js客户端文件
*/
Route::get('/plugin/webman/push/push.js', function (Request $request) {
return response()->file(base_path().'/vendor/webman/push/src/push.js');
});