public function defaultScope()
{
$scope = parent::defaultScope();
if ($this->hasAttribute('status')) {
$tableAlias = $this->getTableAlias(true, false);
$condition = $tableAlias . '.status >= 0';
if (isset($scope['condition'])) {
if (strpos($scope['condition'], 'status') === false) {
$scope['condition'] = '(' . $scope['condition'] . ') AND (' . $condition . ')';
}
} else {
$scope['condition'] = $condition;
}
}
return $scope;
}