Level 1
I think you have to add optional parameter(by suffixing ?)
https://laravel.com/docs/7.x/routing#parameters-optional-parameters
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
Hi there I have a route which sometimes accepts parameters in the query string, but the problem is whenever I add a parameter to the query string I got 404 response code for my api.
Route::prefix('users')->group(function () {
Route::put('profile', 'UserController@updateProfile')->middleware(['ability:owner,edit-users']);
Route::get('profile', 'UserController@showProfile');
Route::get('activities', 'UserActivityController@index');
}
localhost/api/v1/users/activities?page=0
Please or to participate in this conversation.