This adds methods to format addresses and phone numbers to an Eloquent model in Laravel 5. It also adds geocoding functionality using GeocoderLaravel.
The AddressableTrait file is pretty simple and easy to understand so modify it to suit your needs. If you have additional functionality that you would like to see added please let me know.
It can be found on Packagist.
The recommended way is through composer.
Edit composer.json and add:
And install dependencies:
$ composer update
If you do not have Composer installed, run these two commands:
$ curl -sS https://getcomposer.org/installer | php
$ php composer.phar install
In your model add the AddressableTrait.
class MyModel extends Model
The AddressableTrait assumes that your model has the following fields. You are not required to have all of the fields, only the fields that that are needed for the methods you want to use.
See the CHANGELOG file
Please open an issue on GitHub
Please note that this project is released with a Contributor Code of Conduct.
By participating in this project you agree to abide by its terms.
AddressableModel is released under the MIT License. See the bundled
file for details.