protected function apply_soft_delete_filter()
    {
        if ($this->soft_delete && $this->_temporary_with_deleted !== TRUE) {
            if($this->_temporary_only_deleted)
            {
                $where = "`{$this->deleted_at_key}` <= NOW()";
            }
            else
            {
                $where = sprintf('(%1$s > NOW() OR %1$s IS NULL OR %1$s = \'0000-00-00 00:00:00\')', $this->deleted_at_key);
            }

            $this->_database->where($where);
        }
    }