mirror of
https://github.com/snipe/snipe-it.git
synced 2025-01-24 12:17:05 -08:00
Cleanup dashboard controller
We ajax this data in now
This commit is contained in:
parent
7a05467dbf
commit
07882110fa
|
@ -30,49 +30,13 @@ class DashboardController extends Controller
|
||||||
// Show the page
|
// Show the page
|
||||||
if (Auth::user()->hasAccess('admin')) {
|
if (Auth::user()->hasAccess('admin')) {
|
||||||
|
|
||||||
$asset_stats['total'] = Asset::Hardware()->count();
|
$asset_stats=null;
|
||||||
|
|
||||||
$asset_stats['rtd']['total'] = Asset::Hardware()->RTD()->count();
|
|
||||||
|
|
||||||
if ($asset_stats['rtd']['total'] > 0) {
|
|
||||||
$asset_stats['rtd']['percent'] = round(($asset_stats['rtd']['total']/$asset_stats['total']) * 100);
|
|
||||||
} else {
|
|
||||||
$asset_stats['rtd']['percent'] = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
$asset_stats['pending']['total'] = Asset::Hardware()->Pending()->count();
|
|
||||||
|
|
||||||
if ($asset_stats['pending']['total'] > 0) {
|
if ((!file_exists(storage_path().'/oauth-private.key')) || (!file_exists(storage_path().'/oauth-public.key'))) {
|
||||||
$asset_stats['pending']['percent'] = round(($asset_stats['pending']['total']/$asset_stats['total']) * 100);
|
\Artisan::call('passport:install');
|
||||||
} else {
|
\Artisan::call('migrate', ['--force' => true]);
|
||||||
$asset_stats['pending']['percent'] = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
$asset_stats['deployed']['total'] = Asset::Hardware()->Deployed()->count();
|
|
||||||
|
|
||||||
if ($asset_stats['deployed']['total'] > 0) {
|
|
||||||
$asset_stats['deployed']['percent'] = round(($asset_stats['deployed']['total']/$asset_stats['total']) * 100);
|
|
||||||
} else {
|
|
||||||
$asset_stats['deployed']['percent'] = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
$asset_stats['undeployable']['total'] = Asset::Hardware()->Undeployable()->count();
|
|
||||||
|
|
||||||
if ($asset_stats['undeployable']['total'] > 0) {
|
|
||||||
$asset_stats['undeployable']['percent'] = round(($asset_stats['undeployable']['total']/$asset_stats['total']) * 100);
|
|
||||||
} else {
|
|
||||||
$asset_stats['undeployable']['percent'] = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
$asset_stats['archived']['total'] = Asset::Hardware()->Archived()->count();
|
|
||||||
|
|
||||||
if ($asset_stats['archived']['total'] > 0) {
|
|
||||||
$asset_stats['archived']['percent'] = round(($asset_stats['archived']['total']/$asset_stats['total']) * 100);
|
|
||||||
} else {
|
|
||||||
$asset_stats['archived']['percent'] = 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue