PHP code example of sibds / yii2-trash-behavior
1. Go to this page and download the library: Download sibds/yii2-trash-behavior 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/ */
sibds / yii2-trash-behavior example snippets
public function behaviors()
{
return [
\sibds\behaviors\TrashBehavior::className(),
];
}
$model->delete();
$model->restore();
public static function find()
{
return (new \sibds\behaviors\TrashQuery(get_called_class()))->findRemoved();
}
$posts = Post::find()->all();
$count = Post::find()->onlyRemoved()->count();
$allPosts = Post::find()->withRemoved()->all();