Package Data | |
---|---|
Maintainer Username: | nemesis1988 |
Package Create Date: | 2017-04-11 |
Package Last Update: | 2017-04-11 |
Language: | PHP |
License: | UNLICENSE |
Last Refreshed: | 2024-11-19 03:03:34 |
Package Statistics | |
---|---|
Total Downloads: | 114 |
Monthly Downloads: | 0 |
Daily Downloads: | 0 |
Total Stars: | 1 |
Total Watchers: | 2 |
Total Forks: | 0 |
Total Open Issues: | 0 |
LaraGis provides geospatial database and Eloquent features to Laravel.
Features:
ST_AsGeoJSON()
To get started with Socialite, add to your composer.json
file as a dependency:
composer require ralphschindler/laragis
After installing the Socialite library, register the LaraGis\LaraGisProvider
in your config/app.php
configuration file:
'providers' => [
// Other service providers...
LaraGis\LaraGisProvider::class,
],
To use in Eloquent
based models, use the LaraGisTrait
, and specify a column to be cast into a geospatial datatype with the laragis
key in the $casts array:
class Place extends Model
{
use LaraGisTrait;
protected $table = 'places';
protected $casts = [
'coordinates' => 'laragis'
];
}
$place = App\Places::find(1);
$coordinates = $place->coordinates;
echo $coordinates->getLatitudeLongitude(); // "30, -90"
/**
* @property double $latitude
* @property double $longitude
*/
class Coordinates {
public function __construct($latitude = null, $longitude = null);
public function setLatitude($latitude);
public function getLatitude();
public function setLongitude($longitude);
public function getLongitude();
public function castToString($separator, $coordinatesOrder = self::LATITUDE_FIRST)
}
class Area implements \IteratorAggregate, \Countable {
public function addCoordinates(Coordinates $coordinates);
public function getCoordinates();
}