在Laravel 5中无法显示谷歌地图


Can't Show Google Map in Laravel 5

尝试使用javascript通过blade.php文件显示谷歌地图,当我在浏览器中路由显示空白页面时。这里是控制器代码

 class ItemsController extends Controller {
   public function map(){
      $items = Item::all();
      return view('items.map',compact('items'));
}

}

And blade.php Code

@extends('app')
@section('content')
    <div class="container">
        <div class="row">
            <div id="map-canvas"></div>
        </div>
    </div>
    <script type="text/javascript">
        var mapOptions ={
            zoom :4,
            center:new google.maps.LatLng({{$items[0]->location}})
        }
        var map = new google.maps.Map(document.getElementById("map-canvas"),mapOptions);;
        @foreach($items as $item)
            var marker{{$item->id}}=new google.maps.Marker({
            position: new google.maps.LatLng({{$item->location}}),
            map:map,
            title:"{{$item->title}}"
        });
        @endforeach
    </script>

数据库迁移文件在这里:

public function up()
    {
        Schema::create('items', function(Blueprint $table)
        {
            $table->increments('id');
            $table->string('title');
            $table->timestamps();
        });
        DB::statement('ALTER TABLE items ADD location POINT');
    }

你可以试试这个

[https://github.com/fwartner/maps]