From b2660002b93fb41dfd227f70e78fba70dc9b85ac Mon Sep 17 00:00:00 2001 From: snipe Date: Tue, 24 Nov 2020 12:15:07 -0800 Subject: [PATCH] Fixed #8781 - added asset count by status type (#8806) --- app/Http/Kernel.php | 1 + app/Http/Middleware/AssetCountForSidebar.php | 33 ++++++++++++++++++++ resources/views/layouts/default.blade.php | 16 +++++++--- 3 files changed, 45 insertions(+), 5 deletions(-) create mode 100644 app/Http/Middleware/AssetCountForSidebar.php diff --git a/app/Http/Kernel.php b/app/Http/Kernel.php index 0045496791..dd29a4f66a 100644 --- a/app/Http/Kernel.php +++ b/app/Http/Kernel.php @@ -38,6 +38,7 @@ class Kernel extends HttpKernel \App\Http\Middleware\CheckLocale::class, \App\Http\Middleware\CheckForTwoFactor::class, \Laravel\Passport\Http\Middleware\CreateFreshApiToken::class, + \App\Http\Middleware\AssetCountForSidebar::class, ], 'api' => [ diff --git a/app/Http/Middleware/AssetCountForSidebar.php b/app/Http/Middleware/AssetCountForSidebar.php new file mode 100644 index 0000000000..123f6e82c5 --- /dev/null +++ b/app/Http/Middleware/AssetCountForSidebar.php @@ -0,0 +1,33 @@ +count(); + $total_deployed_sidebar = Asset::Deployed()->count(); + $total_archived_sidebar = Asset::Archived()->count(); + $total_pending_sidebar = Asset::Pending()->count(); + $total_undeployable_sidebar = Asset::Undeployable()->count(); + view()->share('total_rtd_sidebar', $total_rtd_sidebar); + view()->share('total_deployed_sidebar', $total_deployed_sidebar); + view()->share('total_archived_sidebar', $total_archived_sidebar); + view()->share('total_pending_sidebar', $total_pending_sidebar); + view()->share('total_undeployable_sidebar', $total_undeployable_sidebar); + + return $next($request); + } +} diff --git a/resources/views/layouts/default.blade.php b/resources/views/layouts/default.blade.php index 6c40babe14..9ccadc745d 100644 --- a/resources/views/layouts/default.blade.php +++ b/resources/views/layouts/default.blade.php @@ -403,24 +403,26 @@