Aug 7, 2023
0
Level 5
Inertia lazy shared data
Hi guys,
can someone explain me how does lazy shared data work in inertia?
https://inertiajs.com/shared-data
class HandleInertiaRequests extends Middleware
{
public function share(Request $request)
{
return array_merge(parent::share($request), [
// Synchronously...
'appName' => config('app.name'),
// Lazily...
'auth.user' => fn () => $request->user()
? $request->user()->only('id', 'name', 'email')
: null,
]);
}
}
If I tried it, the data still was in every response.
Please or to participate in this conversation.