Home>

The route is set in PHP laravel.
Currently, you can check the path in/and/search.
(Displayed properly)

is
Route :: get ('/{user}/{repo}/{branch} [/ {path:. *}]&Apos;,'SearchController @ show');
As below the branch I want to pass whatever path comes.

For example
/ user/repo/branch/path1/path2/path3
/ user/repo/branch/path1/path2
/ user/repo/branch/path1
After branch, I want to pass through an unspecified number of paths.

Error message

Sorry, the page i am looking for could not be found.
It becomes and route does not pass.
Route :: get ('/{user}/{repo}/{branch}/{path1}/{path2}]','SearchController @ show');
If i specify the number of paths below the branch, such as
The route passes when I get/user/repo/branch/path1/path2

I couldn't do any of the following.
Route :: get ('/{user}/{repo}/{branch} [/ {path:. *}]&Apos;,'SearchController @ show');

Route :: get ('/{user}/{repo}/{branch}/{path?}','SearchController @ show');

Route :: get ('/{user}/{repo}/{branch}/{*}','SearchController @ show');

Sorry, the page i am looking for could not be found.
Applicable source code
Route :: get ('/ {user}/{repo}/{branch} [/ {path:. *}]', 'SearchController @ show');
Tried

Change [/{path:.*}] to *. *.
Change to {path?}.
None of the error texts changed

Supplemental information (FW/tool version etc.)

Please provide more detailed information here.

  • Answer # 1

    If there is always at least one path

    Route :: get ('/ {user}/{repo}/{branch}/{path}', 'SearchController @ show')->where ('path ','. * ');


    I think that the routing error will not occur.

    If the URL is/user/repo/branch/path1/path2/path3,$pathispath1/path2/path3will be included, soexplode ('/&apos ;, $path)will make it easier to process.