Recently I watched "Cruddy by Design" - Laracon US 2017 and now I'm trying to get rid of any extra methods in my controllers (so I only have index, create, store, show, edit, update and destroy)
Adam Wathan talks about creating new controllers to put those methods in, so for example:
PodcastsController@publish
would become
PublishedPodcastsController@store
So right now my application has these routes:
Route::delete('tags', [TagsController::class, 'bulk_delete']);
Route::resource('tags', TagsController::class);
and I'm not sure how to refactor the bulk_delete
method.
An idea I came up with was to rename the TagsController
controller into TagController
(singular), create a new TagsController
(plural), and move there the bulk_delete
method, so I would have these routes:
Route::resource('tag', TagController::class); // index, create, store, show, edit, update, destroy
Route::resource('tags', TagsController::class)->only([
'delete' // delete => bulk_delete
]);
but I'm not sure that I like it.
Is there any other way to fit the bulk_delete
method in a ResourceController?