public function getGavatarProfile($hashed_email, $default_name = null) { if (!\Request::wantsJson() && !\Request::ajax()) { \App::abort(404); } if (empty($hashed_email)) { \App::abort(404); } $profile = ['name' => $default_name, 'about' => '', 'location' => '']; $gravatar_profile = \Gravatar::profile($hashed_email, false); $gravatar_profile = $gravatar_profile['entry'][0]; if ($gravatar_profile) { if (!empty($gravatar_profile['name']['formatted'])) { $profile['name'] = $gravatar_profile['name']['formatted']; } if (!empty($gravatar_profile['aboutMe'])) { $profile['about'] = $gravatar_profile['aboutMe']; } if (!empty($gravatar_profile['currentLocation'])) { $profile['location'] = $gravatar_profile['currentLocation']; } } //return json return \Response::json($profile); }