sjorsvanleeuwen/route-resource-extension

Resource extension to allow softDeletes

v1.0 2021-05-15 20:48 UTC

This package is auto-updated.

Last update: 2024-05-16 03:46:03 UTC


README

This package attempts to help with building routes for models with softdeletes.

It adds a macro to extend the existing routes and build some other routes on top of it for restoring, and an index of trashed models.

Pull in the package:

composer require sjorsvanleeuwen/route-resource-extension

Next, open your route file and modify a resource route like so:

Route::resource('myresource', MyResourceController::class)->withSoftDeletes();

Next to the normal routes this will create the following routes:

Method URI Name Action
GET|HEAD myresource/trash myresource.trash MyResourceController@trash
PATCH myresource/{myresource}/restore myresource.restore MyResourceController@restore