Giter Club home page Giter Club logo

nova-map-address's Introduction

Nova Map Address Field

A Nova field to place a marker on map to get coordinates then it reverse geocoding the coordinates to get a street address

Installation

You can install the package in to a Laravel app that uses Nova via composer:

composer require josrom/nova-map-address

Configuration

Publish the package config file:

php artisan vendor:publish --provider="Josrom\MapAddress\FieldServiceProvider"

This is the contents of the file which will be published at config/map-address.php.

Add the following keys to your .env and .env.example:

MAP_ADDRESS_API_KEY=

Optional: Set map and address language
MAP_ADDRESS_LANGUAGE=es

If you need a Google Maps API key, you can create an app and enable Places API and create credentials to get your API key https://console.developers.google.com.

Usage:

Add the below to Nova/{Model}.php resource:

use Josrom\MapAddress\MapAddress;

[
    MapAddress::make('address'),

    // You can set the initial map location. By default (Spain)
     MapAddress::make('address')
        ->initLocation(38.261842, -0.6868031),
        
    // You can set the location from the model
    MapAddress::make('address')
        ->setLocation($this->latitude, $this->longitude),
        
    // You can select the name of lat/lng fields. By default is lat/lng
    MapAddress::make('address')
        ->setLatitudeField('latitude')
        ->setLongitudeField('longitude'),
    
    // You can select what is the first result set in address field
    MapAddress::make('address')
        ->setGoogleResultType('street_address'),
    
    // You can also set the map zoom level. By default (4)
     MapAddress::make('address')
        ->initLocation(38.261842, -0.6868031)
        ->zoom(12),
]

Package screenshot

Support:

License

The MIT License (MIT). Please see License File for more information.

nova-map-address's People

Contributors

josevte avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

nova-map-address's Issues

Support for Laravel ^8.0

Hi, this package doesn't seem to provide support for Laravel 8. Is it planned? :)

Thank you in advance.
Best regards,

Support for Laravel 7.4.0

Hi guys, I tried to install this package on my Setup but this package does not support laravel 7 yet. Is there an update coming for latest laravel build?

i want to save longitude,latitude values and the address value

Please Update it to able to save the longitude,latitude not just the address
so i implemented it but i cant save longitude,latitude
MapAddress::make('address', 'address')
->initLocation('15.337921', '44.202267')
->zoom(16)
->setLocation($this->latitude, $this->longitude)
->setLatitudeField('latitude')
->setLongitudeField('longitude')

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.