diff --git a/.gitignore b/.gitignore
index a5bf6a6..ac4bf32 100755
--- a/.gitignore
+++ b/.gitignore
@@ -1,20 +1,7 @@
/bootstrap/compiled.php
/vendor
/node_modules
-.idea/workspace.xml
-.idea/tasks.xml
-.idea/dictionaries
-.idea/vcs.xml
-.idea/jsLibraryMappings.xml
-.idea/dataSources.ids
-.idea/dataSources.xml
-.idea/dataSources.local.xml
-.idea/sqlDataSources.xml
-.idea/dynamic.xml
-.idea/uiDesigner.xml
-.idea/gradle.xml
-.idea/libraries
-.idea/mongoSettings.xml
+.idea/
*.iws
/out/
.idea_modules/
diff --git a/.idea/laravel-spatial.iml b/.idea/laravel-spatial.iml
deleted file mode 100644
index 07562a5..0000000
--- a/.idea/laravel-spatial.iml
+++ /dev/null
@@ -1,107 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/modules.xml b/.idea/modules.xml
deleted file mode 100644
index 750254a..0000000
--- a/.idea/modules.xml
+++ /dev/null
@@ -1,8 +0,0 @@
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/php.xml b/.idea/php.xml
deleted file mode 100644
index 821a545..0000000
--- a/.idea/php.xml
+++ /dev/null
@@ -1,51 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/vagrant.xml b/.idea/vagrant.xml
deleted file mode 100644
index c334934..0000000
--- a/.idea/vagrant.xml
+++ /dev/null
@@ -1,7 +0,0 @@
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/README.md b/README.md
index 6e17167..156ff86 100755
--- a/README.md
+++ b/README.md
@@ -1,13 +1,15 @@
# Laravel Spatial extension
This package is fully untested, undocumented and unstable and is a combination of the two great packages:
-- [Laravel PostGIS extension](https://github.com/njbarrett/laravel-postgis)
-- [Laravel MySQL spatial extension](https://github.com/grimzy/laravel-mysql-spatial)
+
+- [Laravel PostGIS extension](https://github.com/njbarrett/laravel-postgis)
+- [Laravel MySQL spatial extension](https://github.com/grimzy/laravel-mysql-spatial)
## Installation
Installation made super-easy with [composer](https://getcomposer.org):
-```
+
+```bash
composer require apptimists/laravel-spatial
```
@@ -21,16 +23,56 @@ If you try using it on a shared host which is not fulfilling those requirements,
## Usage
-We use the [GeoJson PHP Library](http://jmikola.github.io/geojson/) for describing spatial fields as GeoJSON object, e.g.:
+### Migrations
+
+Add spatial fields to your migrations the same way you would any others:
+
+```php
+ $table->point('point_column');
+ $table->linestring('line_string_column');
+ $table->polygon('polygon_column');
+ $table->geometry('geometry_column');
+
+ $table->multipoint('multi_point_column');
+ $table->multilinestring('multi_line_string_column');
+ $table->multipolygon('multi_polygon_column');
+ $table->geometrycollection('geometry_collection_column');
+```
+
+### Models
+
+Any models that use spatial fields need to use the `LaravelSpatial\Eloquent\SpatialTrait`, and list the spatial fields themselves in the `$spatialFields` property:
+
+```php
+use LaravelSpatial\Eloquent\SpatialTrait;
+
+// ...
+
+class MyModel extends Model
+{
+ use SpatialTrait;
+
+ // ...
+
+ protected $spatialFields = ['location'];
+
+ // ...
+}
```
+
+### Values
+
+We use the [GeoJson PHP Library](http://jmikola.github.io/geojson/) for describing spatial fields as GeoJSON object, e.g.:
+
+```php
use GeoJSON\Geometry\Point;
-
-...
-
+
+// ...
+
$eloquent = new MyModel();
$eloquent->location = new Point([49.7, 6.9]);
-
-...
-
+
+// ...
+
$eloquent->save();
```