/**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function destroy($id)
 {
     $materialType = MaterialType::find($id);
     if (isset($materialType)) {
         $materialType->delete();
     }
 }
 /**
  * Show the form for creating a new resource.
  *
  * @return Response
  */
 public function create(Phpgmaps $gmpas)
 {
     $config['center'] = config('gmap.center');
     $config['zoom'] = 15;
     $gmpas->initialize($config);
     $marker = [];
     $marker['position'] = config('gmap.center');
     $marker['draggable'] = true;
     $marker['ondragend'] = '$("#latitude").val(event.latLng.lat()); $("#longitude").val(event.latLng.lng());';
     $gmpas->add_marker($marker);
     $map = $gmpas->create_map();
     $material_types = MaterialType::lists('name', 'id');
     return view('materials.create')->with('map', $map)->with('material_types', $material_types)->with('title', trans('titles.new_materials_raw'));
 }