From 62c4c1c6774ee8d54bf79e1b397b52dfd6d7a142 Mon Sep 17 00:00:00 2001 From: Chris Friemann Date: Mon, 22 Jan 2024 12:38:31 +0100 Subject: [PATCH 01/13] feat: add real data --- src/app/Http/Controllers/AdminController.php | 29 +++++++++++++++----- 1 file changed, 22 insertions(+), 7 deletions(-) diff --git a/src/app/Http/Controllers/AdminController.php b/src/app/Http/Controllers/AdminController.php index e292d35..40906fc 100644 --- a/src/app/Http/Controllers/AdminController.php +++ b/src/app/Http/Controllers/AdminController.php @@ -2,6 +2,10 @@ namespace App\Http\Controllers; +use App\Models\Fine; +use App\Models\Item; +use App\Models\Reservation; +use App\Models\User; use Illuminate\Http\Request; use Inertia\Inertia; @@ -9,15 +13,26 @@ class AdminController extends Controller { public function index() { + $user = auth()->user(); + + if (!$user) { + // $user = auth()->loginUsingId(1); + return Inertia::location('/'); + } + + // Get the Statistics + $items = Item::count(); + $customers = User::count(); + $reservations = Reservation::count(); + $invoices = Fine::count(); + return Inertia::render('admin/index', [ - 'userData' => [ - 'name' => 'John Doe', - ], + 'userData' => $user, 'count' => [ - 'items' => 10, - 'customers' => 20, - 'reservations' => 30, - 'invoices' => 40, + 'items' => $items, + 'customers' => $customers, + 'reservations' => $reservations, + 'invoices' => $invoices, ], 'chart1' => [ 'labels' => ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug'], From 7aaae214eaceec73382328d43927e350c23bb3da Mon Sep 17 00:00:00 2001 From: Chris Friemann Date: Mon, 22 Jan 2024 12:40:21 +0100 Subject: [PATCH 02/13] fix: name always = John Doe and default count --- src/resources/vue/pages/admin/index.vue | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/src/resources/vue/pages/admin/index.vue b/src/resources/vue/pages/admin/index.vue index eb282fb..a7dd847 100644 --- a/src/resources/vue/pages/admin/index.vue +++ b/src/resources/vue/pages/admin/index.vue @@ -1,5 +1,5 @@