machour/yii2-softdelete-trait

This extension allow you to soft delete your ActiveRecord entities

Installs: 12 370

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 1

Forks: 2

Open Issues: 0

Type:yii2-extension

1.0.0 2015-11-20 09:41 UTC

This package is auto-updated.

Last update: 2024-11-16 03:32:16 UTC


README

This trait allow you to store any attribute change happening to an ActiveRecord

Installation

The preferred way to install this extension is through composer.

Either run

php composer.phar require machour/yii2-softdelete-trait "*"

or add

"machour/yii2-softdelete-trait": "*"

to the require section of your composer.json file.

Configuration

You need to configure your model as follows:

class Article extends ActiveRecord
{
    use \machour\yii2\behaviors\SoftDeleteTrait;

    static public function getDeletedAtAttribute() 
    {
        return self::tableName() . '.deleted_at';
    }

}