fix routing when middleware is not set

This commit is contained in:
Matthew Goslett 2017-07-27 11:34:47 +02:00
parent ae787ce05a
commit e8fd484da4

View file

@ -1,5 +1,12 @@
<?php <?php
Route::get(config('prometheus.metrics_route_path'), 'MetricsController@getMetrics') $route = Route::get(
->middleware(config('prometheus.metrics_route_middleware')) config('prometheus.metrics_route_path'),
->name('metrics'); \Superbalist\LaravelPrometheusExporter\MetricsController::class . '@getMetrics'
)->name('metrics'); /** @var \Illuminate\Routing\Route $route */
$middleware = config('prometheus.metrics_route_middleware');
if ($middleware) {
$route->middleware($middleware);
}