We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 5b5f9b3 commit cb84170Copy full SHA for cb84170
readme.md
@@ -136,6 +136,24 @@ Inertia::share('auth.user', function () {
136
];
137
}
138
});
139
+
140
+// Multiple values
141
+Inertia::share([
142
+ // Synchronously
143
+ 'app' => [
144
+ 'name' => Config::get('app.name')
145
+ ],
146
+ // Lazily
147
+ 'auth' => function () {
148
+ return [
149
+ 'user' => Auth::user() ? [
150
+ 'id' => Auth::user()->id,
151
+ 'first_name' => Auth::user()->first_name,
152
+ 'last_name' => Auth::user()->last_name,
153
+ ] : null;
154
+ ];
155
+ }
156
+]);
157
~~~
158
159
You can also get shared data using the same method `Inertia::share($key)`. If the key is not found, `null` is returned.
0 commit comments