本文整理汇总了PHP中app\Posts::FetchPosts方法的典型用法代码示例。如果您正苦于以下问题:PHP Posts::FetchPosts方法的具体用法?PHP Posts::FetchPosts怎么用?PHP Posts::FetchPosts使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类app\Posts
的用法示例。
在下文中一共展示了Posts::FetchPosts方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getUserPosts
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);
}
}
}
示例2: getUserProfile
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);
}
}
}