In Laravel, itโs quite convenient to quickly generate a load of routes using a route resource:
Route::resource('things'ThingsController');
This will create all the necessary RESTful routes for CRUD operations. One of them is the PUT / PATCH route, which can be defined as follows:
PUT/PATCH things/{id} ThingsController@update things.update
I read that itโs better to explicitly define each of your routes, rather than using a route resource, but how would I define the PUT / PATCH route above. I understand what I can do
Route::put('thing/{id}', ['as' => 'things.update']);
or
Route::patch('thing/{id}', ['as' => 'things.update']);
But the second overwrites or conflicts with the first, allowing the things.update route things.update to refer only to a PUT or PATCH request. How can I explicitly create a combined PUT / PATCH route created by a resource route?
source share