I'm trying to remove the PUT
method on one of my controllers, but I cannot find a way to do so without going through and mapping each method to a function.
I have the following in my route file:
Route::group(['prefix' => 'api'], function() {
$defaultOptions = ['except' => ['create', 'edit']];
Route::resource('recipies', 'RecipieController', $defaultOptions);
//This is the one that I am trying to restrict
Route::resource('recipies.ingredients', 'Recipie\IngredientController', ['except' => ['create', 'edit', 'show']]);
Route::resource('ingredients', 'IngredientController', $defaultOptions);
});
I know that I can do the following to accomplish what I am wanting, but I am hoping that there is some option where I can limit what methods are allowed
Route::get('recipies/{recipie_id}/ingredients', 'Recipie\IngredientController');
Route::patch('recipies/{recipie_id}/ingredients/{ingredient_id}', 'Recipie\IngredientController');
Route::delete('recipies/{recipie_id}/ingredients/{ingredient_id}', 'Recipie\IngredientController');
While the above will work, I feel that it is messy and am hoping for a cleaner solution.