mirror of
https://github.com/snipe/snipe-it.git
synced 2024-11-10 07:34:06 -08:00
Cache totals for later dashboard use
This commit is contained in:
parent
92052442e3
commit
7b1265cb89
|
@ -32,15 +32,18 @@ class DashboardController extends Controller
|
|||
|
||||
$asset_stats=null;
|
||||
|
||||
|
||||
$counts['asset'] = \App\Models\Asset::count();
|
||||
$counts['accessory'] = \App\Models\Accessory::count();
|
||||
$counts['license'] = \App\Models\License::assetcount();
|
||||
$counts['consumable'] = \App\Models\Consumable::count();
|
||||
$counts['grand_total'] = $counts['asset'] + $counts['accessory'] + $counts['license'] + $counts['consumable'];
|
||||
|
||||
if ((!file_exists(storage_path().'/oauth-private.key')) || (!file_exists(storage_path().'/oauth-public.key'))) {
|
||||
\Artisan::call('passport:install');
|
||||
\Artisan::call('migrate', ['--force' => true]);
|
||||
}
|
||||
|
||||
|
||||
return View::make('dashboard')->with('asset_stats', $asset_stats);
|
||||
return View::make('dashboard')->with('asset_stats', $asset_stats)->with('counts', $counts);
|
||||
} else {
|
||||
// Redirect to the profile page
|
||||
return redirect()->intended('account/view-assets');
|
||||
|
|
Loading…
Reference in a new issue