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');