kingshark
1 month ago
448
8
Laravel

route problem

Posted 1 month ago by kingshark

here is a simple example:

Route::get('/post/{id}', '[email protected]');

// ...

Route::get('/post/new', '[email protected]');

if we write routes in this order, the /post/new will always be recognized as first route pattern by Laravel route resolver. The solution is pretty simple, we can change the order or add where condition behind post/{id} route.

My question is: How should we call this problem? "route conflict" seems too broaden to define the problem. Does the problem have a name or doesn't it even deserve a specific name?

Please sign in or create an account to participate in this conversation.