user(); return array_merge(parent::share($request), [ 'auth' => [ 'user' => $user ? [ 'id' => $user->id, 'name' => $user->name, 'email' => $user->email, 'avatar' => $user->avatar_url, 'roles' => $user->getRoleNames(), 'permissions' => $user->getAllPermissions()->pluck('name'), ] : null, ], 'flash' => [ 'success' => fn() => $request->session()->get('success'), 'error' => fn() => $request->session()->get('error'), 'warning' => fn() => $request->session()->get('warning'), 'info' => fn() => $request->session()->get('info'), ], 'app' => [ 'name' => config('app.name'), 'version' => config('app.version', '1.0.0'), 'env' => config('app.env'), ], 'navigation' => $this->buildNavigation($user), ]); } private function buildNavigation($user): array { if (!$user) return []; $nav = [ ['name' => 'Dashboard', 'href' => '/', 'icon' => 'LayoutDashboard', 'key' => 'dashboard'], ['name' => 'Hypervisors', 'href' => '/hypervisors', 'icon' => 'Server', 'key' => 'hypervisors'], ['name' => 'VMs', 'href' => '/virtual-machines', 'icon' => 'Monitor', 'key' => 'vms'], ['name' => 'Templates', 'href' => '/templates', 'icon' => 'Layers', 'key' => 'templates'], ['name' => 'Containers', 'href' => '/containers', 'icon' => 'Box', 'key' => 'containers'], ['name' => 'Stacks', 'href' => '/stacks', 'icon' => 'Boxes', 'key' => 'stacks'], ['name' => 'Cloud', 'href' => '/cloud', 'icon' => 'Cloud', 'key' => 'cloud'], ['name' => 'Security', 'href' => '/security', 'icon' => 'Shield', 'key' => 'security'], ['name' => 'Backups', 'href' => '/backups', 'icon' => 'HardDrive', 'key' => 'backups'], ['name' => 'Monitoring', 'href' => '/monitoring', 'icon' => 'Activity', 'key' => 'monitoring'], ['name' => 'Identity', 'href' => '/identity', 'icon' => 'KeyRound', 'key' => 'identity'], ['name' => 'Wiki', 'href' => '/wiki', 'icon' => 'BookOpen', 'key' => 'wiki'], ]; if ($user->hasRole(['admin', 'super-admin'])) { $nav[] = ['name' => 'ACL', 'href' => '/acl', 'icon' => 'Users', 'key' => 'acl']; $nav[] = ['name' => 'Admin', 'href' => '/admin', 'icon' => 'Settings','key' => 'admin']; } return $nav; } }