Closed kadriev-ilyas closed 4 years ago
Thanks for PR!
Can you explain why we need _file
? I googled a bit, but didn't find anything relevant.
Thanks for PR!
Can you explain why we need
_file
? I googled a bit, but didn't find anything relevant.
It is because you use "_file" variable in routing rules:
// Instead we'll pass them via app which is slower but fine for development.
$router->group(['prefix' => 'assets'], function ($router) {
$filePattern = '^([a-z0-9_\-\.]+)$';
$router->get('fonts/{_file}', [
'as' => 'image',
'uses' => 'AssetsController@font'
])->where('_file', $filePattern);
$router->get('img/{_file}', [
'as' => 'image', 'uses' => 'AssetsController@image'
])->where('_file', $filePattern);
$router->get('{_file}', [
'as' => 'file',
'uses' => 'AssetsController@index'
])->where('_file', $filePattern);
});
And construction like this:
{{ route('api-tester.file', ['_file' => 'api-tester.js']) }}
trying to find route api-tester.file and place 'api-tester.js' instead of _file variable.
In your code you use file
and this variable not exists in rules and nothing returning by this rule
Got it. Thanks!
Using Str::contains instead of deprecated str_contains https://laravel.com/docs/5.8/helpers#method-str-contains