Level 75
It's a problem with regex. Change it to
[0-9]+
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
Hello,
I have this route, but for some reason when the student id its 10 or higher I receive 404 error, but lower ID open correctly.
http://localhost/students_report/7 Good!
http://localhost/students_report/11 Error 404!
I checked the student with 11 id and already exist!
It's something wrong with my route?
//Students Report
Route::get('/students_report/{student}', 'StudentController@studentReport')
->where('student', '[0-9+]')
->middleware('auth');
Laravel versión 8 upgraded from 6, 7, 8.
Note: I modified my Route Service Provider to keep old routes.
It's a problem with regex. Change it to
[0-9]+
Please or to participate in this conversation.