Laravel-admin: How to use map field

Created on 14 Feb 2018  ·  2Comments  ·  Source: z-song/laravel-admin

  • Laravel Version: #.#.#
  • PHP Version:
  • Laravel-admin: #.#.#

Description:

Steps To Reproduce:

Most helpful comment

Simply add a map field in the admin controller class.

        ...

        $form->text('lat');

        $form->text('lon');

        $form->map('lat', 'lon', 'Mapa');

        ...

In app/Admin/boostrap.php file is important delete or comment this line:

Encore\Admin\Form::forget(['map', 'editor']);

You can add your google map api key in your .env file:

GOOGLE_API_KEY=xxxxxxxxxx

All 2 comments

Simply add a map field in the admin controller class.

        ...

        $form->text('lat');

        $form->text('lon');

        $form->map('lat', 'lon', 'Mapa');

        ...

In app/Admin/boostrap.php file is important delete or comment this line:

Encore\Admin\Form::forget(['map', 'editor']);

You can add your google map api key in your .env file:

GOOGLE_API_KEY=xxxxxxxxxx

@rasmalan Thanks for good idea and example, but it doesn't work for me. The main reason is form fields duplicating, because map component generates two hidden inputs with names of first and second function argument. This way map's fields duplicate text fields and these fieds values don't save after form submitting at all (empty values getted).

Was this page helpful?
0 / 5 - 0 ratings

Related issues

chenyongmin picture chenyongmin  ·  3Comments

piian picture piian  ·  3Comments

amun1303 picture amun1303  ·  3Comments

evans-kim picture evans-kim  ·  3Comments

clock1129 picture clock1129  ·  3Comments