2017 © Pedro Peláez
 

library geodistance

image

evasquez/geodistance

  • Tuesday, June 21, 2016
  • by evervasquez
  • Repository
  • 1 Watchers
  • 0 Stars
  • 153 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 3 Versions
  • 0 % Grown

The README.md

GeoDistance

GeoDistance allows you to search for locations within a radius using latitude and longitude values with your eloquent models., (*1)

Setup

Add geodistance to your composer file., (*2)

"evasquez/geodistance": "dev-master"

Add the geodistance trait to your eloquent model and latitude/longitude columns to your table., (*3)

<?php namespace App\Models;

use Illuminate\Database\Eloquent\Model;
use Jackpopp\GeoDistance\GeoDistanceTrait;

class Location extends Model {

    use GeoDistanceTrait;

    protected $fillable = ['name', 'latitude', 'longitude'];

}

You can now search for locations within a distance, using miles or kilometers:, (*4)


$lat = 51.4833; $lng = 3.1833; $table = 'youtable' $locations = Location::within(5, 'miles', $lat, $lng,$table)->get(); $locations = Location::within(5, 'kilometers', $lat, $lng,$table)->get();

You can also search for locations outside a certain distance:, (*5)

Distances Available, (*6)

Miles (miles/m) Kilometers (kilometers/km) Nautical Miles (nautical_miles) Feet (feet), (*7)

The Versions

21/06 2016

dev-master

9999999-dev

  Sources   Download

The Requires

 

by eveR Vásquez

21/06 2016

1.9

1.9.0.0

  Sources   Download

The Requires

 

by eveR Vásquez

21/06 2016

1.0

1.0.0.0

  Sources   Download

The Requires

 

by eveR Vásquez