Request prefix to any? Hi everyone so im looking for a way for doing a full wildcard to anything with a prefix....
for example Anyone who hits files/* or files/more_files/my_super_file.mp3
will be directed to the same controller and same class function.
is this possible?
You can set up a custom route. You need to use a constraint to accept wildcard parameters with slashes. https://laravel.com/docs/5.4/routing#parameters-regular-expression-constraints
// web.php -- Web Routes File
Route::get('files/{path}', 'FilesController@show')->where('path', '(.*)');
// {path} is a wildcard that will get passed to the show method
// FilesController
public function show($path) {
// get the file ...
}
hey jbloom this is for lumen and unfortunately where on a route is not available. :(
awesome answer for laravel though :D
Oops. I didn't notice it was on the Lumen channel. I'm not too familiar with Lumen, but maybe you can inspect the request path.
...
$request->path();
...
Please sign in or create an account to participate in this conversation.