%PDF- %PDF-
Mini Shell

Mini Shell

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

<?php

namespace App\Services;

use App\Repositories\LocationRepository;

class LocationService
{
    /**
     * Search locations based on a string queried
     *
     * @param string $location
     * @return array $data
     */
    public static function searchLocations($location)
    {
        $data = LocationRepository::searchLocationsAutoComplete($location);

        return $data;
    }

    /**
     * Return the lat and lng of a certain location
     * that has been searched
     *
     * @param string $location
     * @return array
     */
    public static function getLatitudeAndLongitude($location) : array
    {
        $data = LocationRepository::searchLocationLatLng($location);

        if( !empty($data['results']) ) {
            $data = $data['results'][0]['geometry']['location'];
        }

        return [
            'lat' => $data['lat'] ?? null,
            'lng' => $data['lng'] ?? null
        ];
    }
}

Zerion Mini Shell 1.0