From e9ae850002bb462016fbdcc912ec6e57a763eaed Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Thomas=20G=C3=BCnther?=
Date: Thu, 5 Feb 2026 07:40:00 +0100
Subject: [PATCH] Display nicename in dashboard
---
app/Domains/Dashboard/Views/Dashboard.vue | 2 ++
app/Providers/InertiaProvider.php | 3 +-
app/Resources/UserResource.php | 34 +++++++++++++++++++++++
app/Views/Pages/Home.vue | 14 ----------
public/css/app.css | 9 ++++++
resources/js/layouts/AppLayout.vue | 9 +++---
6 files changed, 52 insertions(+), 19 deletions(-)
create mode 100644 app/Resources/UserResource.php
delete mode 100644 app/Views/Pages/Home.vue
diff --git a/app/Domains/Dashboard/Views/Dashboard.vue b/app/Domains/Dashboard/Views/Dashboard.vue
index 5d0b9d7..dcb2b82 100644
--- a/app/Domains/Dashboard/Views/Dashboard.vue
+++ b/app/Domains/Dashboard/Views/Dashboard.vue
@@ -8,6 +8,8 @@ const props = defineProps({
user: Object,
currentPath: String,
})
+
+console.log(props.user.nicename)
diff --git a/app/Providers/InertiaProvider.php b/app/Providers/InertiaProvider.php
index ea8b422..9ec151f 100644
--- a/app/Providers/InertiaProvider.php
+++ b/app/Providers/InertiaProvider.php
@@ -4,6 +4,7 @@ namespace App\Providers;
use App\Models\Tenant;
use App\Models\User;
+use App\Resources\UserResource;
use Inertia\Inertia;
use Inertia\Response;
@@ -23,7 +24,7 @@ final class InertiaProvider
public function render() : Response {
$this->props['navbar'] = $this->generateNavbar();
$this->props['tenant'] = app('tenant');
- $this->props['user'] = $this->user;
+ $this->props['user'] = new UserResource($this->user)->toArray(request());
$this->props['currentPath'] = request()->path();
$this->props['availableLocalGroups'] = Tenant::where(['is_active_local_group' => true])->get();
diff --git a/app/Resources/UserResource.php b/app/Resources/UserResource.php
new file mode 100644
index 0000000..d07185c
--- /dev/null
+++ b/app/Resources/UserResource.php
@@ -0,0 +1,34 @@
+user = $user;
+ }
+
+ public function toArray($request) {
+ $data = array_merge(
+ $this->user->toArray(),
+ [
+ 'nicename' => $this->user->getNicename(),
+ 'fullname' => $this->user->getFullName()
+ ]);
+
+ unset($data['password']);
+ unset($data['remember_token']);
+ unset($data['email_verified_at']);
+ unset($data['created_at']);
+ unset($data['updated_at']);
+ unset($data['activation_token']);
+ unset($data['activation_token_expires_at']);
+
+ return $data;
+
+ }
+}
diff --git a/app/Views/Pages/Home.vue b/app/Views/Pages/Home.vue
deleted file mode 100644
index 2d058b3..0000000
--- a/app/Views/Pages/Home.vue
+++ /dev/null
@@ -1,14 +0,0 @@
-
-
-
-
- {{ appName }}
- Laravel + Inertia + Vue läuft 🚀
-
-
-
-
diff --git a/public/css/app.css b/public/css/app.css
index 27dced7..f2cdbd7 100644
--- a/public/css/app.css
+++ b/public/css/app.css
@@ -124,3 +124,12 @@ th {
th:after {
content: ":";
}
+
+#show_username {
+ position: relative;
+ top: -30px;
+ width: calc(100% - 20px);
+ display: block;
+ font-weight: bold;
+ text-align: right;
+}
diff --git a/resources/js/layouts/AppLayout.vue b/resources/js/layouts/AppLayout.vue
index e2c85af..e9561f4 100644
--- a/resources/js/layouts/AppLayout.vue
+++ b/resources/js/layouts/AppLayout.vue
@@ -10,9 +10,6 @@ const props = defineProps({
tenant: String,
currentPath: String,
})
-
-console.log(props.currentPath)
-
@@ -68,7 +65,11 @@ console.log(props.currentPath)