Ad
Why Don't Catch The Requested File URI My Defined Route In Laravel 5.7?
I have this codes in my routes/api.php
file:
Route::group(['middleware' => 'auth:api'], function () {
Route::prefix('photoalbum')->group(function() {
Route::prefix('image')->group(function() {
Route::post('download/{albumId}/{size}/{filename}',
'[email protected]');
// ...
});
});
});
Route::fallback('[email protected]');
Now I try to open this URL:
http://myproject.test/api/photoalbum/image/download/1/xs/dog.jpg
...and I get the result from the [email protected]
function. The other routes working fine.
UPDATE
The php artisan route:list
get the correct list of routes, contain this:
| | POST | api/photoalbum/image/download/{albumId}/{size}/{filename} | | App\Http\Controllers\[email protected] | api,auth:api,auth |
Additionally: the requested file isn't exists. The controller should be process and serve it.
Why don't catch the request my defined Route and send it to the [email protected]
function and how can I fix it?
Ad
Answer
Your defined route type is POST and you are trying to access that via GET.
changing your route to Route::get
solves your problem.
Ad
source: stackoverflow.com
Related Questions
- → "failed to open stream" error when executing "migrate:make"
- → October CMS Plugin Routes.php not registering
- → OctoberCMS Migrate Table
- → OctoberCMS Rain User plugin not working or redirecting
- → October CMS Custom Mail Layout
- → October CMS - How to correctly route
- → October CMS - Conditionally Load a Different Page
- → Make a Laravel collection into angular array (octobercms)
- → In OctoberCMS how do you find the hint path?
- → How to register middlewares in OctoberCMS plugin?
- → Validating fileupload(image Dimensions) in Backend Octobercms
- → OctoberCMS Fileupload completely destroys my backend
- → How do I call the value from another backed page form and use it on a component in OctoberCms
Ad