walkor / walkor/webman

How to set plugin route to load before dynamic route?

Open
#407 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
PHP
Stars
2.7k
Forks
251
PR merge metrics
No merged PRs in 30d

Description

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

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with config/route.php and the webman/push plugin's route file, then trace route registration into webman/framework Route and FastRoute using the shown stack trace. Confirm the route order or another supported configuration that avoids the dynamic route shadowing the plugin's static path, and verify the application starts with both routes available.

Written by the indexing model from the issue text.

Assessment

Tech stack
php
Domain
backend
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.