This commit is contained in:
Emanuel Mutschlechner
2018-08-30 13:58:13 +02:00
parent 5247eb66bc
commit 206beb1655
24 changed files with 506 additions and 14353 deletions

View File

@@ -18,31 +18,13 @@ class MapsServiceProvider extends BaseServiceProvider
$this->loadViewsFrom(__DIR__.'/../resources/views', 'maps');
view()->composer('maps::*', function ($view) {
$type = $view->type ?? config('vendor.maps.default');
$enabled = $view->enabled ?? config('vendor.maps.enabled');
$key = config('vendor.maps.maps.'.$type.'.key');
// TODO: Warn missing key?
return $view->with(compact(
'type',
'enabled',
'key'
));
});
view()->composer('maps::index', function ($view) {
$lat = $view->lat ?? config('vendor.maps.lat');
$lng = $view->lng ?? config('vendor.maps.lng');
$zoom = $view->zoom ?? config('vendor.maps.zoom');
$markers = $view->markers ?? config('vendor.maps.markers');
return $view->with(compact(
'lat',
'lng',
'zoom',
'markers'
));
if (!isset($view->service)) {
$view->with('service', config('vendor.maps.default'));
}
if (!isset($view->enabled)) {
$view->with('enabled', config('vendor.maps.enabled'));
}
return $view;
});
}