ソースを参照

fix: HandleInertiaRequest

コミット
38e474ff6c
共有2 個のファイルを変更した3 個の追加5 個の削除を含む
  1. 2
    4
      app/Http/Middleware/HandleInertiaRequests.php
  2. 1
    1
      resources/js/layouts/Dashboard/Components/TopBar.vue

+ 2
- 4
app/Http/Middleware/HandleInertiaRequests.php ファイルの表示

@@ -38,10 +38,8 @@ class HandleInertiaRequests extends Middleware
38 38
     public function share(Request $request): array
39 39
     {
40 40
         return array_merge(parent::share($request), [
41
-            "auth.user" => fn() => $request->user()
42
-                ? $request->user()->only("id", "name", "username", "role_id")
43
-                : null,
44
-            "company.name" => fn() => Company::first()->name ?? null,
41
+            "auth.user" => fn() => $request->user() ?? null,
42
+            "app.company.name" => fn() => Company::first()->name ?? null,
45 43
             "flash" => function () use ($request) {
46 44
                 return [
47 45
                     "success" => $request->session()->get("success"),

+ 1
- 1
resources/js/layouts/Dashboard/Components/TopBar.vue ファイルの表示

@@ -25,7 +25,7 @@ const logout = () => {
25 25
   <div class="layout-topbar">
26 26
     <Link href="/" class="layout-topbar-logo">
27 27
       <img alt="Brand Logo" src="/images/logo.svg" />
28
-      <span>{{ $page.props.company?.name ?? 'Your Company' }}</span>
28
+      <span>{{ $page.props.app.company.name }}</span>
29 29
     </Link>
30 30
 
31 31
     <button