Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Soft delete feature for DeleteAction #21

Open
SOHELAHMED7 opened this issue Dec 29, 2021 · 1 comment
Open

Soft delete feature for DeleteAction #21

SOHELAHMED7 opened this issue Dec 29, 2021 · 1 comment

Comments

@SOHELAHMED7
Copy link
Contributor

In DeleteAction.php

it would be better to add feature that soft-delete the model

Use case and Proposal

Normally different apps have different way to soft delete model/row

  • some have status column which have one of ACTIVE, INACTIVE or DELETED
  • some have is_deleted bool column
  • some have deleted_at column, if null then not deleted, if filled with date time then it is deleted
  • some might have other way to store

So my proposal is to add softDelete property to DeleteAction.php

Data type for it will be ?callable

Signature of callable

function($model) {
    // now it is up to consumer of this package/developer's responsibility to soft delete model as they want
    // e.g. 
    $model->is_deleted = true;
    $model->save(false);
}

If callable is null then we will actually delete like it currently done

I am fine providing pull request.

@Insolita
Copy link
Owner

I think it is too much for this action. You can create a similar SoftDeleteAction with the necessary behavior

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants