You are viewing documentation for an outdated version. It is no longer supported!

List Deleted

The ListDeletedResourcesRequest abstraction is an extended version of List Resources request. It is intended for when "soft-deleted"open in new window resources must be listed.

Example Request

use Aedart\Contracts\Filters\Builder;
use Aedart\Http\Api\Requests\Resources\ListDeletedResourcesRequest;
use App\Models\User;

class ListDeletedUsers extends ListDeletedResourcesRequest
{
    public function authorisationModel(): string|null
    {
        return User::class;
    }

    public function filtersBuilder(): string|Builder|null
    {
        return null;
    }
}

Example Action

Route::get('/users/deleted', function (ListDeletedUsers $request) {
    return UserResource::collection(
        User::onlyTrashed()
            ->paginate($request->show)
    );
})->name('users.trashed');

Authorisation

By default, the request will check against a trashed ability, for the current authenticated user. From the above shown examples, a users.trashed ability is checked.

Pagination

See List Resources pagination section.

Filters Builder

See List Resources filters builder section.

Request Preconditions

See List Resources request preconditions section.