0

OctoberCMS 是否具有软删除表单/列表行为?按照现在,我必须自己实现恢复按钮,我还必须自己实现列表过滤。此功能是否有任何可用的包/插件/示例代码(最好是推荐的实现)?

我做了什么:

  • onRestore.
  • 添加filter列表配置。

谢谢!

4

1 回答 1

2

嗯,对于软删除没有没有插件,要恢复你需要做它by your self,看起来你已经做到了,到目前为止很好

您需要此代码,show records但您可能已经添加了该代码。只是为了提供信息,我在这里添加它。deletedcontroller

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

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

和过滤器,对他们来说也没有插件 :( ,这可以帮助build filter

但似乎将来他们可以将它们添加到构建器插件中(可能是)

对于过滤器,有doc https://octobercms.com/docs/backend/lists#filter-text,您可以使用类型文本过滤器filter particular column基于text search. 为此,您需要使用latest October-CMS build.

你可以从这里参考这个功能
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


此外,如果您想检查代码,您可以检查哪些过滤器现在可用。 https://github.com/octobercms/october/blob/master/modules/backend/widgets/Filter.php

抱歉,但目前似乎没有插件可以帮助您进行软删除和过滤(据我所知)。

于 2018-01-26T13:45:05.743 回答