Download the PHP package liuyuanjun/yii2-softdelete without Composer
On this page you can find all versions of the php package liuyuanjun/yii2-softdelete. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Please rate this library. Is it a good library?
Informations about the package yii2-softdelete
Yii2 软删 yii2-softdelete
Soft delete trait for Yii2.
- 替换了 yii\db\ActiveRecord 的 delete() 方法,软删除时将 is_deleted 字段设置为主键字段的值,而不是删除数据,从而避免了使用删除时间等来标记软删时唯一索引可能产生冲突的问题(设置唯一索引需要将 is_deleted 字段加入,作联合唯一索引)
- 使用forceDelete()方法可硬删除数据
- withTrashed() 方法可在查询时包含软删数据 onlyTrashed() 方法可在查询时只包含软删数据
- 可正常使用Model的 find、delete、save、hasOne、hasMany、via 等方法
安装
composer require liuyuanjun/yii2-softdelete
用法 Usage
在Model类中引入
然后像往常一样正常使用
All versions of yii2-softdelete with dependencies
PHP Build Version
Package Version
The package liuyuanjun/yii2-softdelete contains the following files
Loading the files please wait ....