showDeleted = true; return $this; } public function onlyDeleted(): self { $this->showDeleted = true; return $this->andWhere(['is_deleted' => true]); } public function createCommand($db = null): Command { if ($this->showDeleted === false) { $this->andWhere(['is_deleted' => false]); } return parent::createCommand($db); } }