['user' => auth()->check() ? new UserResource(auth()->user()) : null] ]); \Inertia::share([ 'errors' => function () { return Session::get('errors') ? Session::get('errors')->getBag('default')->getMessages() : (object) []; }, 'title' => function() { return session()->get('title', ''); } ]); $response = $next($request); return $response; } }