PHP code example of dynamicscreen / laravel-geographical

1. Go to this page and download the library: Download dynamicscreen/laravel-geographical library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

dynamicscreen / laravel-geographical example snippets


$table->double('longitude');
$table->double('latitude');

use Geographical;

$query = Model::distance($latitude, $longitude);
$asc = $query->orderBy('distance', 'ASC')->get();
 

$query = Model::geofence($latitude, $longitude, $inner_radius, $outer_radius);
$all = $query->get();

protected static $kilometers = true;

const LATITUDE  = 'lat';
const LONGITUDE = 'lng';