ensureStorageLink(); // Skip during installation if (!$request->is('install/*') && !$request->is('update/*') && file_exists(storage_path('installed'))) { // Share settings with all Inertia responses Inertia::share([ 'globalSettings' => function () { return settings(); // Use our helper function } ]); } return $next($request); } /** * Ensure storage symlink exists */ private function ensureStorageLink() { if (!File::exists(public_path('storage'))) { try { Artisan::call('storage:link'); } catch (\Exception $e) { // Silently fail if unable to create link } } } }