I have this route:
Route::get('product/get/{project_token}/{user_id}/{id}', 'get_project')->where('id', '.*');
Here for the id
param, the value can be any character like
DRGM48/58BA
DRGM48/78BA+BZA43B.
1254EBD
Now, If the id
param value is this DRGM48/78BA+BZA43B
then I can see that the route is not passing the value. It seems like + character is not accepting.
Can you tell me how can I fix it?
2
Answers
Plus sign is used to represent a space character in the query. So for this, you have to use
urlencode
andurldecode
Ex
In controller
I have the same issues in my previous project. So, I have applied multiple solutions but not worked. Then I find the solution which is below.
Description: The "+" character is a reserved character in URLs and is used to represent a space. Laravel’s route parameters use the "+" character as a wildcard, which means that any text after the + character will be ignored.
Hope this help to you.