LaravelPackages.net
Acme Inc.
Toggle sidebar
abr4xas/gmaps-input-backpack

Custom Google Maps Input for Laravel Backpack

3.970
2
v2.0.0
About abr4xas/gmaps-input-backpack

abr4xas/gmaps-input-backpack is a Laravel package for custom google maps input for laravel backpack. It currently has 2 GitHub stars and 3.970 downloads on Packagist (latest version v2.0.0). Install it with composer require abr4xas/gmaps-input-backpack. Discover more Laravel packages by abr4xas or browse all Laravel packages to compare alternatives.

Last updated

Custom Google Maps Input for Laravel Backpack

How to install

with composer:

composer require abr4xas/gmaps-input-backpack

How to use

Add your Google Api Key to the env file:

GOOGLE_MAPS_API_KEY=

Add this to your backpack controller:

$this->crud->addField([
    'name'  => 'address-input', // do not change this
    'type'  => 'customGoogleMaps', // do not change this
    'label' => "Google Maps",
    'hint'  => 'Help text',
    'attributes' => [
        'class' => 'form-control map-input', // do not change this, add more classes if needed
    ],
    'view_namespace' => 'custom-google-maps-field-for-backpack::fields',
]);

Notice the view_namespace attribute - make sure that is exactly as above, to tell Backpack to load the field from this addon package, instead of assuming it's inside the Backpack\CRUD package.

Preview:

Custom Google Maps Input for Laravel Backpack

Thanks to https://laraveldaily.com/laravel-find-addresses-with-coordinates-via-google-maps-api/ for the inspiration.

Star History Chart