framework
framework copied to clipboard
[9.x] Add destroyable singletons
This PR aims to create an easy way to mark singleton routes as 'destroyable'. A destroyable singleton may be deleted, but it may not be created (by default). This is useful when its a resource with a default state and deleting it just resets it to that state, or when it is a resource the user cannot create on his own.
Before:
Route::singleton(...)->creatable()->except('create', 'store');
After:
Route::singleton(...)->destroyable();
When singleton routes came out we rewrote our routes to make use of them, but 8.42.2 (https://github.com/laravel/framework/commit/6ddf3b017ccb8486c8dc5ff5a09d051a40e094ca) changed how they worked by not making them not have a destroy action by default anymore, which this PR is trying to solve.