diff --git a/app/Http/Controllers/HomeController.php b/app/Http/Controllers/HomeController.php index 34a3737..e452cf5 100644 --- a/app/Http/Controllers/HomeController.php +++ b/app/Http/Controllers/HomeController.php @@ -28,7 +28,11 @@ class HomeController extends Controller { $items = User::loggedIn()->items()->with('users')->get(); + $numberOfUsedItems = 0; foreach ($items as $item) { + if (isset($item->used_by)) { + $numberOfUsedItems++; + } $this->getUsername($item->users, $item->used_by); $this->getUsername($item->users, $item->waiting_user_id); } @@ -39,7 +43,7 @@ class HomeController extends Controller return view( 'home', - ['products' => $products, 'users' => $this->activeUsers] + ['products' => $products, 'users' => $this->activeUsers, 'usedItems' => $numberOfUsedItems] ); } diff --git a/resources/views/home.blade.php b/resources/views/home.blade.php index eb60121..b0276d1 100644 --- a/resources/views/home.blade.php +++ b/resources/views/home.blade.php @@ -1,6 +1,13 @@ @extends('layouts.app') @section('content') + + +