public function fbLocationSearch(Request $request) { $term = $request->term; $fb = \FacebookHelper::fb_init(); $response = $fb->get("/search?q={$term}&type=place¢er=15.8700,100.992&limit=5"); return $fb_response = $response->getDecodedBody(); }
public static function userFriend($fb_id) { if (!empty($fb_id)) { $fb = \FacebookHelper::fb_init(); $response = $fb->get("/me/friends", \Auth::user()->access_token); if (!empty($response)) { $fb_response = $response->getDecodedBody(); $x = 0; foreach ($fb_response['data'] as $friend) { $fb_data[$x] = $friend['id']; $x++; } $user_friends = DB::table('users')->whereIn('fb_id', $fb_data)->select('users.fb_id', 'users.username', 'users.avatar')->get(); return $user_friends; } } }
public function ajaxCheckin() { if (isset(\Auth::user()->id)) { $location = Location::get(); $city = $location->cityName; $lat = $location->latitude; $lng = $location->longitude; $distance = 2000; //meters $limit = 8; //QUERY $term = Input::get('term'); $fb = \FacebookHelper::fb_init(); $response = $fb->get("/search?q={$term}&type=place¢er={$lat},{$lng}&distance={$distance}&limit={$limit}", \Auth::user()->access_token); $fb_response = $response->getDecodedBody(); $response_array = \FacebookHelper::fbResponse($fb_response['data']); return $response_array; } else { return "err: need login"; } }