Fixes #2134 - hide archived assets from list all

This commit is contained in:
snipe 2016-09-01 13:28:15 -07:00
parent eee64d5509
commit 67315d81d6
2 changed files with 20 additions and 0 deletions

View file

@ -1676,6 +1676,9 @@ class AssetsController extends Controller
case 'Deployed': case 'Deployed':
$assets->Deployed(); $assets->Deployed();
break; break;
default:
$assets->NotArchived();
break;
} }

View file

@ -628,6 +628,23 @@ public function checkin_email()
}); });
} }
/**
* Query builder scope for non-Archived assets
*
* @param Illuminate\Database\Query\Builder $query Query builder instance
*
* @return Illuminate\Database\Query\Builder Modified query builder
*/
public function scopeNotArchived($query)
{
return $query->whereHas('assetstatus', function ($query) {
$query->where('archived', '=', 0);
});
}
/** /**
* Query builder scope for Archived assets * Query builder scope for Archived assets
* *