Browse Source

fix: HandleInertiaRequest

Muhammad Iqbal Afandi 3 years ago
parent
commit
38e474ff6c

+ 2
- 4
app/Http/Middleware/HandleInertiaRequests.php View File

38
     public function share(Request $request): array
38
     public function share(Request $request): array
39
     {
39
     {
40
         return array_merge(parent::share($request), [
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
             "flash" => function () use ($request) {
43
             "flash" => function () use ($request) {
46
                 return [
44
                 return [
47
                     "success" => $request->session()->get("success"),
45
                     "success" => $request->session()->get("success"),

+ 1
- 1
resources/js/layouts/Dashboard/Components/TopBar.vue View File

25
   <div class="layout-topbar">
25
   <div class="layout-topbar">
26
     <Link href="/" class="layout-topbar-logo">
26
     <Link href="/" class="layout-topbar-logo">
27
       <img alt="Brand Logo" src="/images/logo.svg" />
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
     </Link>
29
     </Link>
30
 
30
 
31
     <button
31
     <button