Wreigh
Wreigh

Reputation: 3297

OctoberCMS Controller Soft Delete

Does OctoberCMS have a soft deleting form/list behavior? As per now, I had to implement the restore button myself, I also had to implement the list filtering myself. Are there any available package/plugin/sample code (preferably recommended implementation) of this feature?

What I have done:

Thank you!

Upvotes: 0

Views: 1256

Answers (1)

Hardik Satasiya
Hardik Satasiya

Reputation: 9715

Hmm, For soft deletion no there is no plugins, for restoration you need to make it by your self and it seems you already made it , so far good.

To show records which are deleted you need this code in your controller but may be you are already added that code. just for information I am adding it here.

public function listExtendQuery($query)
{
    $query->withTrashed();
}

public function formExtendQuery($query)
{
    $query->withTrashed();
}

And filters , well for them there is no plugin as well :( , which can help to build filter.

but seems in future they can add them in builder plugin (may be)

for filters there is doc https://octobercms.com/docs/backend/lists#filter-text , you can use type text filter to filter particular column based on text search. for this you need to use latest October-CMS build.

you can refer this functionality from here
https://github.com/octobercms/october/pull/3094

config_filter.yaml

scopes:
    id:
        label: ID
        type: text
        conditions: id = :value
        size: 2

    username:
        label: Username
        type: text
        conditions: username = :value


Also if you want to check code you can check it which filters are available for now. https://github.com/octobercms/october/blob/master/modules/backend/widgets/Filter.php

sorry, but it seems currently no plugins are there which can help you for soft-delete and filters (according to my knowledge).

Upvotes: 2

Related Questions