%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /home/forge/api-takeaseat.eco-n-tech.co.uk/app/Repositories/
Upload File :
Create Path :
Current File : //home/forge/api-takeaseat.eco-n-tech.co.uk/app/Repositories/LocationRepository.php

<?php

namespace App\Repositories;

use GoogleMaps;

class LocationRepository
{
    /**
     * Autocomplete location search
     *
     * @param string $address
     * @return array $searchResponse
     */
    public static function searchLocationsAutoComplete($address) : array
    {
        $searchResponse = GoogleMaps::load('placeautocomplete')
            ->setParam(['input' => $address])
            ->get('predictions');

        return $searchResponse;
    }

    /**
     * Search location lat and lng
     *
     * @param string $location_name
     * @return array $searchResponse
     */
    public static function searchLocationLatLng($location_name): array
    {
        $searchResponse = GoogleMaps::load('geocoding')
            ->setParam(['address' => $location_name, 'region' => 'UK'])
            ->get('results.geometry.location');

        return $searchResponse;
    }
}

Zerion Mini Shell 1.0