+ Add helper route for Google Geocoding

This commit is contained in:
Djery-Tom 2021-04-26 09:21:07 +01:00
parent 881795c2eb
commit e17ff1ad48
4 changed files with 46 additions and 3 deletions

View File

@ -27,3 +27,5 @@ WALLET_SERVICE_KEY=yhSTSSqIO1uSE1icu09edPOeSFGxIDjo
NOTIFICATION_SERVICE_NAME = notificationService
NOTIFICATION_SERVICE_BASE_URL= http://localhost:8083
NOTIFICATION_SERVICE_KEY=RfXvPQzQRgwpzQYPnLfWpZzgx4QseHlg
GOOGLE_GEOCODING_API_KEY=AIzaSyAixFlmxSD_IM_X3jaRn0OyhfZK3xJSAAk

View File

@ -0,0 +1,36 @@
<?php
namespace App\Http\Controllers;
use GuzzleHttp\Client;
use Illuminate\Http\Request;
class HelperController extends Controller
{
/**
* Create a new controller instance.
*
* @return void
*/
public function __construct()
{
//
}
//
public function getGoogleGeocoding(Request $request)
{
$latitude = $request->input('latitude');
$longitude = $request->input('longitude');
$client = new Client();
$URL = "https://maps.googleapis.com/maps/api/geocode/json";
$response = $client->request('GET', $URL, ['query' => ['latlng' => $latitude . ',' . $longitude, 'key' => env('GOOGLE_GEOCODING_API_KEY')]]);
return $response->getBody()->getContents();
}
}

View File

@ -24,6 +24,7 @@ use Illuminate\Support\Facades\Hash;
* @property string $phone
* @property string $encrypted_password
* @property string $salt
* @property string $type
*
* @package App\Models
@ -45,6 +46,7 @@ class UsersCredentials extends Model implements AuthenticatableContract, Authori
'phone',
'encrypted_password',
'salt',
'type'
];
/**

View File

@ -10,7 +10,10 @@
| and give it the Closure to call when that URI is requested.
|
*/
/*
* Helpers routes
*/
$router->get('/geocode', 'HelperController@getGoogleGeocoding');
//$router->get('/', function () use ($router) {
// return $router->app->version();
//});
@ -107,10 +110,10 @@
//Les historiques globals des hyperviseur et superviseur
$router->get('hyper_history/{id_network}', 'WalletServiceController@get');
$router->get('super_history/{id_wallet}', 'WalletServiceController@get');
$router->get('super_history/{agent_code}', 'WalletServiceController@get');
// Routes sans pagination
$router->get('all_hyper_history/{id_network}', 'WalletServiceController@get');
$router->get('all_super_history/{id_wallet}', 'WalletServiceController@get');
$router->get('all_super_history/{agent_code}', 'WalletServiceController@get');
// Wallets users iLink
$router->group(['prefix' => '/users'] , function () use ($router){