ProfileController.php
This handles user profile information, including fetching and updating user profiles, and retrieving counts of bookmarks, published maps, and maps associated with a user.
getUserProfile
getUserProfilepublic function getUserProfile(Request $request)
{
// Get the user ID from the request input
$userId = $request->input('userId');
// Retrieve the user profile using the User ID from the UserProfile model
$userProfile = UserProfile::where('user_id', $userId)
->first();
// Retrieve the user account using the User ID from the UserAccount model
$userAccount = UserAccount::where('id', $userId)
->first();
// Check if both user profile and user account exist
if (isset($userProfile) && isset($userAccount)) {
// If both exist, create a success response with user information
$response = [
'SUCCESS' => 1,
'USERNAME' => $userAccount->username,
'NAME' => $userProfile->name,
'EMAIL' => $userAccount->email,
'COMPANY' => $userProfile->company,
];
return $response;
} else {
// If either user profile or user account is not found, create a failure response
$response = [
'SUCCESS' => 0,
];
return $response;
}
}updateUserProfile
updateUserProfilegetUserInfo
getUserInfoLast updated