Search code examples
phplaravelvoyager

Render Google Map in Laravel Voyager admin panel


i am trying to show google map in Voyager admin panel i use bread but i get error :

Invalid argument supplied for foreach() (View: path\vendor\tcg\voyager\resources\views\formfields\coordinates.blade.php) (View: paht\vendor\tcg\voyager\resources\views\formfields\coordinates.blade.php)

any solution ?


Solution

  • You should add trait Spatial in your model

    use TCG\Voyager\Traits\Spatial;

    and initialize the field with coordinates

    use TCG\Voyager\Traits\Spatial;
    
    class Product extends Model
    {
      use Spatial;
      protected $spatial = ['coordinates']; //here is going your field name; should be the point type;
    }