public static function getUserPosts($input) { $validation = Validator::make($input, Posts::$UserPostsRules); if ($validation->fails()) { return Response::json(array('status' => '0', 'msg' => $validation->getMessageBag()->first()), 200); } else { $access_token = $input['token']; $other_id = $input['other_id']; $current_time = new DateTime(); $user_id = Users::getUserIdByToken($access_token); if ($user_id) { $result = Posts::FetchPosts($user_id, $other_id); if ($result) { return Response::json(array('status' => '1', 'msg' => 'Post Details', 'result' => $result), 200); } else { return Response::json(array('status' => '2', 'msg' => 'No Post Found'), 200); } } else { return Response::json(array('status' => '0', 'msg' => "Token Expired"), 200); } } }
public static function getUserProfile($input) { $validation = Validator::make($input, Posts::$UserPostsRules); if ($validation->fails()) { return Response::json(array('status' => '0', 'msg' => $validation->getMessageBag()->first()), 200); } else { $access_token = $input['token']; $other_id = $input['other_id']; $user_id = Users::getUserIdByToken($access_token); if ($user_id) { $user_details = Users::LoginTypeResponse($other_id); $user_posts = Posts::FetchPosts($user_id, $other_id); $friends = Users::GetFollowers($other_id); $skillset = Users::Getskillset(); $user_skillset = Users::GetUserSkills($other_id); $follower_data = $friends['followers']; $following_data = $friends['following']; $profile_setup_status = Users::ProfileSetupStatus($user_id); $is_follow_status = Users::getIsFollow($user_id, $other_id); if ($user_details) { return Response::json(array('status' => '1', 'msg' => 'User Details', 'profile_complete_status' => $profile_setup_status, 'result' => $user_details, 'user_posts' => $user_posts, 'followers' => $follower_data, 'following' => $following_data, 'all_skillset' => $skillset, 'user_skillset' => $user_skillset, 'is_follow_status' => $is_follow_status), 200); } else { return Response::json(array('status' => '0', 'msg' => 'User Not Found'), 200); } } else { return Response::json(array('status' => '0', 'msg' => "Token Expired"), 200); } } }