Laravel NotFoundHttpException although route exists Laravel NotFoundHttpException although route exists laravel laravel

Laravel NotFoundHttpException although route exists


With Laravel routes, the order matters. Routes with dynamic segments like files/{file} or resource routes should always be defined after the ones that are static. Otherwise Laravel will interpret the share part in your URL as ID.

So, as you've figured out yourself you simply need to change the order of your routes:

Route::put('/files/share', 'FileController@test');Route::resource('/files', 'FileController');


Thanks to lukasgeiter I checked my routes once more and had to define the /files/share route before my RESTful resource route.