PHP code example of digisin / yii2-softdelete

1. Go to this page and download the library: Download digisin/yii2-softdelete library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

digisin / yii2-softdelete example snippets


public function behaviors() {
    return [
        \digisin\softdelete\SoftDeleteBehavior::className(),
        // or
        [
            'class' => \digisin\softdelete\SoftDeleteBehavior::className(),
            'attribute' => 'deleted_time',
            'value' => new \yii\db\Expression('NOW()'), // for sqlite use - new \yii\db\Expression("date('now')")
        ],
    ];
}

public function behaviors() {
    return [
        \digisin\softdelete\SoftDeleteQueryBehavior::className(),
        // or
        [
            'class' => \digisin\softdelete\SoftDeleteQueryBehavior::className(),
            'attribute' => 'deleted_time',
        ],
    ];
}