getCurrentUser(); if (!$user) { return $this->respondError('Authentication required', Response::HTTP_UNAUTHORIZED); } try { $user = model(User::class); $userInfo = $user->getUserInfoById($user->id); if (!$userInfo) { return $this->respondError('User not found', Response::HTTP_NOT_FOUND); } $firstname = (string) ($userInfo['firstname'] ?? ''); $lastname = (string) ($userInfo['lastname'] ?? ''); return $this->success([ 'firstname' => $firstname, 'lastname' => $lastname, 'fullname' => trim($firstname . ' ' . $lastname), 'initials' => strtoupper(($firstname[0] ?? '') . ($lastname[0] ?? '')), ], 'User info retrieved successfully'); } catch (\Throwable $e) { log_message('error', 'Frontend user error: ' . $e->getMessage()); return $this->respondError('Failed to retrieve user info', Response::HTTP_INTERNAL_SERVER_ERROR); } } public function getPages() { try { return $this->success([ 'pages' => [ 'facility' => '/facility', 'team' => '/team', 'call_to_action' => '/call_to_action', 'testimonial' => '/testimonial', ], ], 'Frontend pages retrieved successfully'); } catch (\Throwable $e) { log_message('error', 'Frontend pages error: ' . $e->getMessage()); return $this->respondError('Failed to retrieve frontend pages', Response::HTTP_INTERNAL_SERVER_ERROR); } } }