1. Go to this page and download the library: Download clevyr/laravel-geocoder 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/ */
use Clevyr\LaravelGeocoder\Traits\Geocodable;
class MyModel extends Model
{
use Geocodable;
}
$model = MyModel::find(1);
$coords = $model->getLatAndLong();
$model->name = 'New Name';
$model->addressIsDirty(); // false
$model->address_line_1 = '123 Foo Ln.';
$model->addressIsDirty(); // true
// Override the postal_code property with something specific to this model
public function getGeocoderPostalCodeAttribute()
{
return 'zip';
}
public function getGeocoderAddressLine1Attribute();
public function getGeocoderAddressLine2Attribute();
public function getGeocoderCityAttribute();
public function getGeocoderStateAttribute();
public function getGeocoderPostalCodeAttribute();
public function getGeocoderCountryAttribute();